【发布时间】:2011-08-24 09:19:29
【问题描述】:
我创建了一个新的 Flex 项目,并在 .mxml 文件中有以下代码。
<?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>
这些是错误:
1120:访问未定义的属性 airSWFLoader。 WebTry.mxml /WebTry/src 第 12 行 Flex 问题
1120:访问未定义的属性 loaderContext。 WebTry.mxml /WebTry/src 第 10 行 Flex 问题
这个想法是能够让air.swf文件在上面的代码中工作,以检测我们的air应用程序是否安装,从浏览器启动air应用程序等。
【问题讨论】:
标签: air flash mxml flash-builder