flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Admin Billing App" <ad...@billingapp.pw>
Subject Flex Beginner-- Unable to display web page within 2 StageWebViews on single screen app
Date Wed, 15 May 2013 17:41:41 GMT
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.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message