Module实例
<mx:ModuleLoader width="100%" height="100%" url="demo.swf"></mx:ModuleLoader>
<fx:Script><![CDATA[private function loadModule():void{moduleLoader.unloadModule();moduleLoader.url="demo.swf";}]]></fx:Script><mx:ModuleLoader id="moduleLoader" width="100%" height="100%"></mx:ModuleLoader>
<fx:Script><![CDATA[import mx.controls.Alert;import mx.events.ModuleEvent;import mx.modules.IModuleInfo;import mx.modules.Module;import mx.modules.ModuleManager;private var moduleInfo:IModuleInfo;private var module:Module;private function loadModule():void{//---------------------------------------------moduleInfo=ModuleManager.getModule("demo.swf");//---------------------------------------------moduleInfo.addEventListener(ModuleEvent.READY, moduleInfo_readyHandler);moduleInfo.addEventListener(ModuleEvent.ERROR, moduleInfo_errorHandler);moduleInfo.load();}private function moduleInfo_readyHandler(event:ModuleEvent):void{//---------------------------------------------module=event.module.factory.create() as Module;//---------------------------------------------this.addElement(module);}private function moduleInfo_errorHandler(event:ModuleEvent):void{Alert.show(event.errorText, "提示");}]]></fx:Script>