I would like to use JavaScript in my air application but can't get the air app to load the loacal (included) html file.
This is the content of the html file:
<html>
<head>
<script>
function setHeader(st) {
document.getElementById('hiTitle').innerHTML = st;
}
</script>
</head>
<body>
<h1 id="hiTitle">Hello there</h1>
</body>
</html>
This is the mxml file:
<?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>
If I change the location of mx:html like so: location="http://labs.adobe.com/"
It does show the html, both files are located in the same directory.
Using flex 4.6 sdk with flashbuilder with no errors or warnings when building the project.