我在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>
- stereo