Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex webstageview不在手机上加载,但在emulator中工作_Apache Flex_Flash Builder - Fatal编程技术网

Apache flex webstageview不在手机上加载,但在emulator中工作

Apache flex webstageview不在手机上加载,但在emulator中工作,apache-flex,flash-builder,Apache Flex,Flash Builder,我正试图让WebTageView加载本地html文件…这段代码在模拟器上运行得很好,但当我在android设备(运行android 2.3)上运行它时,它不起作用…它只是创建了一个空白WebTageView,它从不加载本地html文件…缩放功能完好无损,所以我知道它正在打开WebTageView,但我从来没看过内容……有什么建议吗?我被卡住了 <?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.a

我正试图让WebTageView加载本地html文件…这段代码在模拟器上运行得很好,但当我在android设备(运行android 2.3)上运行它时,它不起作用…它只是创建了一个空白WebTageView,它从不加载本地html文件…缩放功能完好无损,所以我知道它正在打开WebTageView,但我从来没看过内容……有什么建议吗?我被卡住了

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:ns1="*"
    xmlns:controls="com.flexcapacitor.controls.*"
    actionBarVisible="false" backKeyPressed="onBackKeyPressed(event)"
    creationComplete="view1_creationCompleteHandler(event)" title="{data.image}"
    xmlns:components="com.flexcapacitor.components.*">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
    <![CDATA[
        import mx.events.FlexEvent;

        import spark.components.ViewNavigator;

        public var webView1:StageWebView=new StageWebView();


        protected function view1_creationCompleteHandler(event:FlexEvent):void
        {

            webView1.stage=this.stage;
            webView1.viewPort=new Rectangle(0,50,stage.stageWidth, stage.stageHeight);
            var fPath:String=new File(new File("app:/"+data.html).nativePath).url;
            webView1.loadURL(fPath);


        }
        protected function onBackKeyPressed(event:FlexEvent):void{
            webView1.viewPort = null;
            webView1.dispose();
            webView1 = null;
        }


        protected function backbutton_clickHandler(event:MouseEvent):void
        {
            webView1.viewPort = null;
            webView1.dispose();
            webView1 = null;
            navigator.popView();
        }

    ]]>
</fx:Script>
<s:Button id="backbackbutton" x="0" y="0" width="100%" height="50" label="Back" click="backbutton_clickHandler(event)"/>


您是否已将“应用程序”文件夹添加到生成路径,以便html文件包含在发布生成中?如果没有,请右键单击您的项目并转到属性>Actionscript构建路径>源路径>添加文件夹…

我最后不得不创建一些临时文件以正确打开它…不确定为什么它在模拟器正常工作之前无法工作…下面是代码:

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:ns1="*"
    xmlns:controls="com.flexcapacitor.controls.*"
    actionBarVisible="false" backKeyPressed="onBackKeyPressed(event)"
    creationComplete="view1_creationCompleteHandler(event)" title="{data.image}"
    xmlns:components="com.flexcapacitor.components.*">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
    <![CDATA[
        import mx.events.FlexEvent;

        import spark.components.ViewNavigator;

        public var webView1:StageWebView=new StageWebView();


        protected function view1_creationCompleteHandler(event:FlexEvent):void
        {

            webView1.stage=this.stage;
            webView1.viewPort=new Rectangle(0,50,stage.stageWidth, stage.stageHeight);
          var fa:File = File.applicationDirectory.resolvePath(data.html);
            var f2a:File = File.createTempDirectory();
            var fb:File = File.applicationDirectory.resolvePath(data.location);
            fa.copyTo(f2a.resolvePath(data.html),true);
            fb.copyTo(f2a.resolvePath(data.location),true);
            webView1.loadURL(f2a.url + File.separator +data.html);


        }
        protected function onBackKeyPressed(event:FlexEvent):void{
            webView1.viewPort = null;
            webView1.dispose();
            webView1 = null;
        }


        protected function backbutton_clickHandler(event:MouseEvent):void
        {
            webView1.viewPort = null;
            webView1.dispose();
            webView1 = null;
            navigator.popView();
        }

    ]]>
</fx:Script>
<s:Button id="backbackbutton" x="0" y="0" width="100%" height="50" label="Back"
          accentColor="#000000" chromeColor="#404040" click="backbutton_clickHandler(event)"
          color="#FFFFFF"/>


所有内容都在我的原始src文件夹下。完整路径是src/assets/chapter1images/image1.html。data.html=“assets/chapter1images/image1.html我尝试在一行中添加trace(“尝试加载”+fPath);并且跟踪在尝试加载时读取以下内容file:///C:/Users/Brett/Adobe%20Flash%20Builder%204.5/graysanatomymobile3/bin-debug/assets/chapter1images/image1.html为什么要在模拟器中运行,而不是在设备上运行?如果它是src??my bes的子文件夹,我还需要向源路径添加文件夹吗我猜你在设备上运行时无法访问Android文件系统,或者在设备上运行时无法理解fPath。你是否尝试过webView1.loadURL('assets/chapter1images/image1.html')?emulator=AIR的内置emulator或Google的Android emulator?