gpt4 book ai didi

flash - Flex Mobile StageWebView 不显示

转载 作者:行者123 更新时间:2023-12-02 05:04:24 25 4
gpt4 key购买 nike

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

最佳答案

webView.stage = this.stage;

当它在creationComplete 事件处理程序中时,this.stage 仍然为空。

您应该将 init() 放在 addedToStage 事件处理程序中。

关于flash - Flex Mobile StageWebView 不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13373971/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com