Hope I'm not too late, but first of all have a look at this function:

#1 protected function createMain(e:Event):void {
#2        removeEventListener(Event.**ADDED_TO_STAGE, createMain);
#3        mainArea = new StageWebView();
#4        mainArea.stage = stage;
#5        mainArea.viewPort = new Rectangle(0, 160, stage.width,
stage.height);
#6        mainArea = new StageWebView();
#7        mainArea.addEventListener(**LocationChangeEvent.LOCATION_**CHANG
E, mainAreaLocationChange);
#8        mainArea.stage = stage;
#9        actualurl="http://www.msn.com/**";;
#10      mainArea.loadURL(actualurl);
#11 }

>From lines 3 to 5 you set up the StageWebView object, this looks ok to me.
Then on line 6 you create a new object without any setup, nor attachment to
stage, reassign it to the mainArea variable and work with that. This won't
work. Another thing to mention is that you define stage.width and
stage.height as width and height parameters, if you want to have both views
visible
you need to divide one of these by two and adjust the x or y coordinate of
the adArea accordingly.

I created a very simple app doing roughly what you need, in terms of
loading the and displaying the web pages
https://gist.github.com/anonymous/5606857 I believe you can take it from
here.

On Thu, May 16, 2013 at 10:21 AM, Arvind Dievs Software <
arv...@dievssoftware.com> wrote:

> Hi
>
> I have seen Flex apps (created by others as tutorials) where 2 web views
> are used on single screen....I saw this post where a blogger showed a
> leadbolt/admob ad in the top portion of the screen, with a web page being
> shown in the bottom portion.
>
> So thats not the issue- and I cant figure out whats wrong with my app ....
>
> Arvind.
>
>
> -----Original Message----- From: Elena Geller
> Sent: Wednesday, May 15, 2013 11:44 PM
> To: users@flex.apache.org
> Subject: Re: Flex Beginner-- Unable to display web page within 2
> StageWebViews on single screen app
>
>
> I guess two StageWebView on single screen may be impossible.
> Am 15.05.2013 20:11 schrieb "Admin Billing App" <ad...@billingapp.pw>:
>
>  Hello all,
>>
>> I am a newbie to using Flex, and I am now creating a simple Flex app->
>> this has a single screen having 2 StageWebViews –> both are used to
>> display
>> different web pages within them.
>> ( I am trying to create simple mobile apps that do this).
>>
>> For some reason, both StageWebViews are showing blank-
>>
>> This is the code in the main mxml file--
>>
>> These are the initial variables declared--
>>
>>             import mx.events.FlexEvent;
>>             import spark.events.**ViewNavigatorEvent;
>>             protected var adArea:StageWebView;
>>             protected var mainArea:StageWebView;
>>             protected var adFile:File;
>>             protected var mainFile:File;
>>             protected var actualurl:String= new String();
>>
>> This is the content of the init function--
>>
>>             protected function init(event:ViewNavigatorEvent)**:void {
>>                    addEventListener(Event.ADDED_**TO_STAGE, createAd);
>>                     addEventListener(Event.ADDED_**TO_STAGE, createMain);
>>             }
>>
>> Now the “createAd” and “createMain” functions are nearly identical in
>> functionality—> they basically open 2 different web pages in the 2
>> StageWebViews named “adArea” and “mainArea” respectively.
>>
>> Now I am giving below the code for “createMain”--
>>
>> protected function createMain(e:Event):void {
>>         removeEventListener(Event.**ADDED_TO_STAGE, createMain);
>>         mainArea = new StageWebView();
>>         mainArea.stage = stage;
>>         mainArea.viewPort = new Rectangle(0, 160, stage.width,
>> stage.height);
>>         mainArea = new StageWebView();
>>         mainArea.addEventListener(**LocationChangeEvent.LOCATION_**
>> CHANGE,
>> mainAreaLocationChange);
>>         mainArea.stage = stage;
>>         actualurl="http://www.msn.com/**";;
>>         mainArea.loadURL(actualurl);
>> }
>>
>>
>> And finally given below is the function “mainAreaLocationChage”--
>>
>>
>> protected function mainAreaLocationChange(event:**LocationChangeEvent):void
>> {
>>     if (mainArea.location != actualurl) {
>>         navigateToURL(new URLRequest(event.location));
>>         adArea.loadURL(actualurl);
>>     }
>> }
>>
>> As I mentioned before, when I run the above program—both the web views
>> simply show up as white blank areas. I am not sure what I am doing wrong
>> here? I am using Flash Builder 4.6/4.7 Premium on Windows 8 (x64).
>>
>> Any help would be appreciated.
>>
>> Yours sincerely,
>> Arvind.
>>
>>
>>
>


-- 
Martin Miko

Reply via email to