Flex Mobile 4.6 (Flash Builder 4.6) で StageWebView を表示する際に問題が発生しました。動的に作成すると、イベントは適切に呼び出されますが、何も表示されません。コードは次のとおりです。
<components:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:components="spark.components.*"
actionBarVisible="false"
title="ActivityView"
creationComplete="init()"
>
<components:layout>
<s:BasicLayout/>
</components:layout>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
private var webView:StageWebView;
protected function init():void {
webView = new StageWebView();
webView.stage = this.stage;
webView.viewPort = new Rectangle(5, 20, screen.width-10, screen.height-40);
webView.addEventListener(Event.COMPLETE, onURLLoadComplete);
webView.addEventListener(LocationChangeEvent.LOCATION_CHANGE, onLocationChange);
webView.loadURL("http://google.com");
}
protected function onURLLoadComplete(event:Event):void
{
trace("Load Complete");
}
protected function onLocationChange(event:LocationChangeEvent):void
{
trace("Location change: " + event.location);
}
]]>
</fx:Script>
</components:View>