Home Tutorial Flex Flex-components ModuleLoader in Flex 3

 
 

Share on Google+Share on Google+
ModuleLoader in Flex 3
Posted on: July 12, 2010 at 12:00 AM
Advertisement
In this example user can load modules with the help of ModuleLoader class. This is simple way to load modules in the main application.
Load modules with the help of ModuleLoader class:-

In this example user can load modules with the help of ModuleLoader class. This is simple way to load modules in the main application. We can used <mx:ModuleLoader> tag to load a modules and set the url property to point the location of the swf files. If user want to unload modules then you can be set url value is null(""). User can used multiple ModuleLoader class instances in one application.

Example:-

 main.mxml code:-

<?xml version="1.0"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

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

</mx:Application>

 


loginmodule.mxml code:-

<?xml version="1.0"?>

<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" >

<mx:Script><![CDATA[

import mx.controls.Alert;

private function submit():void{

var name:String = loginnametext.text;

var password:String = loginpasswordtext.text;

if(name!="" && password!=""){

Alert.show("User Name is :" + name);

loginnametext.text = "";

loginpasswordtext.text = "";

}

else{

Alert.show("Enter correct name and password!");

}

}

]]>

</mx:Script>

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

<mx:HBox width="302">

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

<mx:TextInput id="loginnametext"/>

</mx:HBox>

<mx:HBox width="301">

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

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

</mx:HBox>

<mx:HBox>

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

</mx:HBox>

</mx:Panel>

</mx:Module>


In this example you can see hoe to used module manager for load modules in the application.

Output:-


Download this code
Advertisement

Related Tags for ModuleLoader in Flex 3:


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.

Posted on: July 12, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com