我有一个仅加载外部 SWF 的 Flex 应用程序,但该应用程序无限加载和卸载我的 swf。
嵌入的 as3 代码是:
<![CDATA[
import mx.events.FlexEvent;
private var m_Application:Application;
private function initGenderMenuApp(evt:FlexEvent):void{
m_Application = evt.target as Application;
m_Application.removeEventListener( FlexEvent.APPLICATION_COMPLETE, initMenuApp );
var loader:Loader = new Loader();
trace("initApp");
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onFailedLoad);
loader.contentLoaderInfo.addEventListener( Event.COMPLETE, onLoadedApp );
loader.load( new URLRequest( "application.swf" ));
}
private function onFailedLoad( evt:Event ):void{
trace("ERROR", evt.target);
}
private function onLoadedApp( evt:Event ):void{
trace("Loading Application..");
var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
loaderInfo.removeEventListener( Event.COMPLETE, onLoadedApp);
trace(loaderInfo.loader.content);
m_Application.addElement( new SpriteUIComponent( evt.target.loader.content as MovieClip));
}
]]>
SpriteUIComponent 用于将 SWF 作为 Sprite 添加到舞台上。
问候