I have an iPhone app which uses facebook. The user experience is not great if you just create a stagewebview object because of the lag in anything showing up when the page is being downloaded. The way I tried to get around it is like this:
ShowLoadingAnimation();
webView = new StageWebView();
webView.stage = this.stage;
webView.viewPort = new Rectangle( 0,0,0,0);
webView.addEventListener(Event.COMPLETE,PageLoaded);
public function PageLoaded(e:Event):void
{
webView.viewPort = new Rectangle( 0, 105, 600,295);
RemoveLoadingAnimation();
}
So create an empty stageview which is obscured by a beautiful 🙂 loading animation and when the page has been loaded – we resize the webview to it’s proper size. Works perfect in a desktop AIR player. But on an iPhone it doesn’t work at all and you end up with a very large black box.
Anyone has any idea on how to fix this OR a better way of doing this?
By default stageWebView objects are always at the top of the display list stack.
This means that your loading animation is underneath.
The correct way to do this is to show your loading animation and then wait to set the stage property of the stageWebView object until the page is loaded.
Hope this helps.