I have created a new Flex project and have the following code in a .mxml file.
<?xml version="1.0"?>
<!-- usingas/StatementSyntax.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="doSomething()">
<mx:Script><![CDATA[
var airSWF:Object; // This will be the reference to the main class of air.swf
var airSWFLoader:Loader = new Loader(); // Used to load the SWF
var loaderContext:LoaderContext = new LoaderContext();
// Used to set the application domain domain
loaderContext.applicationDomain = ApplicationDomain.currentDomain;
airSWFLoader.contentLoaderInfo.addEventListener(Event.INIT, onInit);
airSWFLoader.load(new URLRequest("http://airdownload.adobe.com/air/browserapi/air.swf"),
loaderContext);
function onInit(e:Event):void
{
airSWF = e.target.content;
}
]]></mx:Script>
<mx:Label id="label1"/>
</mx:Application>
These are the errors:
1120: Access of undefined property airSWFLoader. WebTry.mxml /WebTry/src line 12 Flex Problem
1120: Access of undefined property loaderContext. WebTry.mxml /WebTry/src line 10 Flex Problem
The idea is to be able to get the air.swf file working in the above code to detect if our air app is installed, launch the air app from the browser, etc.