Module load, progress, ready, setup and unload events
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
import mx.events.FlexEvent;
import mx.events.ModuleEvent;
import mx.modules.ModuleManager;
private var flag:Boolean = true;
private var dynamicModule:ModuleLoader;
private function changeMac():void
{
dynamicModule = new ModuleLoader();
dynamicModule.url = "a.swf";
this.addChild( dynamicModule );
mlRuntimeCSS.loadModule();
mlDateWidget2.loadModule();
mlRuntimeCSS.unloadModule();
mlDateWidget2.unloadModule();
dynamicModule.loadModule();
dynamicModule.unloadModule();
}
private function eventHandler( event:Event ):void
{
trace( "Control: " + event.currentTarget + " type: " + event.type );
}
</mx:Script>
<mx:Button label="Change Mac" click="changeMac()" />
<mx:ModuleLoader id="mlRuntimeCSS"
url="a.swf"
loading="eventHandler( event )"
progress="eventHandler( event )"
ready="eventHandler( event )"
setup="eventHandler( event )"
unload="eventHandler( event )" />
<mx:ModuleLoader id="mlDateWidget2"
url="a.swf"
loading="eventHandler( event )"
progress="eventHandler( event )"
ready="eventHandler( event )"
setup="eventHandler( event )"
unload="eventHandler( event )" />
</mx:Application>
Related examples in the same category