如何在flex 4.6移动应用程序中加载html文件

时间:2014-02-03 13:31:22

标签: actionscript-3 flex air flash-builder

我的问题是我想在flex移动应用程序中加载html文件我尝试了很多方法通过StageWebView使用它但不能正常工作 我的代码示例:

                if(StageWebView.isSupported==true){
                stageWebView = new StageWebView();
                stageWebView.stage = this.stage;
                stageWebView.viewPort = new Rectangle(5 , 500, stage.stageWidth, ((stage.stageHeight-90)/4));
                var fPath:String = new File(new File("assets/ads.html").nativePath).url;
                stageWebView.loadURL(fPath);    
                addEventListener(ViewNavigatorEvent.REMOVING,onRemove);
            }

更新:使用

解决了问题
                    var htmlString:String = "<!DOCTYPE HTML>" + 
                    "<html><body>" +
                    "<p>Bsmallah</p>" +
                    "</body></html>";
                stageWebView.loadString( htmlString );

但我无法在其中加载脚本

然后任何帮助我如何加载它 提前谢谢。

1 个答案:

答案 0 :(得分:-1)

以下这条线搞砸了。

new File(new File("assets/ads.html").nativePath).url

如果您正在寻找当前的应用程序目录,可以使用File.applicationDirectory获取当前目录,这样您就可以重新编写上面的行,如下所示

var fPath:String = File.applicationDirectory + "/" + "assets/ads.html";
相关问题