ModuleLoader API provide methods loadModule() for load module and unloadModule() for unload modules
ModuleLoader API provide methods loadModule() for load module and unloadModule() for unload modulesloadModule and unloadModule methods for modules:-
ModuleLoader API provide methods loadModule() for load module and unloadModule() for unload modules. These methods take no parameters. These methods load or unload module on the bases of current url property. In this example user can see how to load or unload module on button click events.
Example:-
loginmodule.mxml code
|
<?xml version="1.0"?> <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" >Alert.show( "User Name is :" + name);loginnametext.text = "";loginpasswordtext.text = "";} else{Alert.show( "Enter correct name and password!");} } ]]> </mx:Module> |
main.mxml code
|
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"><![CDATA[ import mx.modules.*;ml.url = s; return;} ml.loadModule(); } ml.unloadModule(); } ]]> </mx:Script> <mx:Panel title="Load / Unload method example" height="50%" width="50%"></mx:Application> |
After compile these code after that run main.swf and show result.
Output:-
1. Output For loadModule() method:-

2. Output for unloadModule() method:-
