エア アプリケーションで JavaScript を使用したいのですが、エア アプリケーションでローカル (インクルード) html ファイルをロードできません。
これは、html ファイルの内容です。
<html>
<head>
<script>
function setHeader(st) {
document.getElementById('hiTitle').innerHTML = st;
}
</script>
</head>
<body>
<h1 id="hiTitle">Hello there</h1>
</body>
</html>
これは 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 >>"
click="tracehtml()"/>
</mx:WindowedApplication>
mx:html の場所を次のように変更した場合: location="http://labs.adobe.com/"
html は表示されますが、両方のファイルが同じディレクトリにあります。
プロジェクトをビルドするときにエラーや警告なしで flashbuilder で flex 4.6 SDK を使用します。