Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/404.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/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
Javascript Can';t获取air应用程序以加载项目中包含的html文件_Javascript_Apache Flex_Air_Flashdevelop - Fatal编程技术网

Javascript Can';t获取air应用程序以加载项目中包含的html文件

Javascript Can';t获取air应用程序以加载项目中包含的html文件,javascript,apache-flex,air,flashdevelop,Javascript,Apache Flex,Air,Flashdevelop,我想在air应用程序中使用JavaScript,但无法让air应用程序加载loacal(包括)html文件 这是html文件的内容: <html> <head> <script> function setHeader(st) { document.getElementById('hiTitle').innerHTML = st; } </script> </head> <body> <h1 id="hiTitl

我想在air应用程序中使用JavaScript,但无法让air应用程序加载loacal(包括)html文件

这是html文件的内容:

<html>
<head>
<script>
function setHeader(st) {
    document.getElementById('hiTitle').innerHTML = st;
}
</script>
</head>
<body>
<h1 id="hiTitle">Hello there</h1>
</body>
</html>

函数setHeader(st){
document.getElementById('hiTitle')。innerHTML=st;
}
你好
这是mxml文件:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    private function tracehtml():void {
        trace(htmlZ);
        htmlZ.htmlLoader.window.setHeader("never works");
    }
    ]]>
    </mx:Script>

    <mx:Panel x="10" y="10" width="252" height="100%"
    layout="absolute" title="The local html file">
        <mx:HTML
            id="htmlZ"
            location="script.html"
            enabled="true"
            paddingLeft="4"
            paddingRight="4"
            width="100%" height="100%"/>
    </mx:Panel>

    <mx:Button x="270" y="65" label="Highlight &gt;&gt;"
        click="tracehtml()"/>

</mx:WindowedApplication>

如果我像这样更改mx:html的位置: 位置=”http://labs.adobe.com/"

它确实显示html,两个文件位于同一目录中


将flex 4.6 sdk与flashbuilder结合使用,在构建项目时不会出现错误或警告。

flashbuilder的答案非常简单。将html文件和js文件放在名为assets的文件夹中,并将该文件夹放在应用程序的bin目录中

现在,当使用F5(projset=>testproject)运行air应用程序时,它就可以工作了

在项目文件夹中有一个名为bat的文件夹。我签出了bat文件,Packager将工作目录更改为bin,然后告诉adt(AdobeAIR开发工具)包含当前目录(=bin)中的所有内容

打开命令提示符并转到项目文件夹,然后键入以下命令:

bat\SetupSDK.bat
bat\CreateCertificate.bat
(wait a minute)
bat\SetupApplication.bat
bat\Packager.bat
对于不使用flashbuilder的用户,adt命令如下(项目名称为google):

现在在air文件夹下创建了一个air文件,用winrar打开它(它是一个zip文件),并确认资产目录在那里


双击该文件启动安装程序,打开已安装的应用程序后,该程序与在flashdevelop中测试时一样工作。

如果我将script.html放在bin文件夹中(flashdevelop将swf放在该文件夹中),则它可以工作。现在,我必须找到一种方法,在swf中编译html,并使用什么路径作为位置值。
adt -package  -storetype pkcs12 -keystore "bat\Google.p12" -storepass fd air\Google.air application.xml -C bin .