Share on Google+Share on Google+

Module in Flex 3

In the Flex 3, Modules are dynamically loadable SWF that contains an IFlexModuleFactory class factory.

Module in Flex 3:-

In the Flex 3,  Modules are dynamically loadable SWF that contains an IFlexModuleFactory class factory. They can be loaded if application requires to load these module and they can be unloaded when application no longer needs a module.  These modules can not be run independently of an application. In this example you can see how to create a module with the help of module class. More then one applications also used these modules. An MXML-based module file's root tag is <mx:Module>.

First we will create a module after that we will compile it.


This is loginmodule.mxml code:-

<?xml version="1.0"?>

<mx:Module xmlns:mx="" width="100%" height="100%" >


import mx.controls.Alert;

private function submit():void{

var name:String = loginnametext.text;

var password:String = loginpasswordtext.text;

if(name!="" && password!=""){"User Name is :" + name);

loginnametext.text = "";

loginpasswordtext.text = "";


else{"Enter correct name and password!");





<mx:Panel id="loginpanel" height="200" width="328">

<mx:HBox width="302">

<mx:Label id="loginname" text="Enter name "/>

<mx:TextInput id="loginnametext"/>


<mx:HBox width="301">

<mx:Label id="loginpassword" text="Enter password"/>

<mx:TextInput id="loginpasswordtext" displayAsPassword="true"/>



<mx:Button label="Submit" click="submit()"/>




main.mxml code:-

<?xml version="1.0"?>

<mx:Application xmlns:mx="">

<mx:ModuleLoader url="loginmodule.swf"/>


In this example user can also see we have too use module loader class for load login module in the main application.


Download this code

ModuleLoader in Flex 3
In this example user can load modules with the help of ModuleLoader class. This is simple way to load modules in the main application.
ModuleManager for load or unload module in Flex 3
In this example, we will used module manager to load and unload modules in the application
loadModule and unloadModule method in Flex 3
ModuleLoader API provide methods loadModule() for load module and unloadModule() for unload modules



Posted on: July 12, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null