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: [email protected]
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" <[email protected]>:

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.



Reply via email to