Loading Modules Based on Menu Selection


<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221; layout=”absolute” width=”100%” height=”100%” >

<mx:Style>
.MyApplicationControlBar {
highlightAlphas: 0.28, 0.28;
fillAlphas: 0.36, 0.57;
fillColors: #3399ff, #33ccff;
backgroundColor: #3300ff;
backgroundAlpha: 0.09;
cornerRadius: 0;
shadowDistance: 7;
shadowDirection: left;
dropShadowColor: #ffffff;
}
</mx:Style>

<mx:Script>

<![CDATA[

import mx.events.MenuEvent;
import mx.controls.Menu;
import mx.controls.Alert;
import mx.events.ModuleEvent;
import mx.modules.ModuleManager;
import mx.modules.IModuleInfo;
import mx.core.IUIComponent;

private function menuItemHandler(event:MenuEvent):void
{
applicationModulePanl.title=event.item.@label;
loadModule.url=event.item.@url;
}

]]>
</mx:Script>

<mx:VBox width=”100%” height=”100%”  y=”9″ x=”9″>

<mx:ApplicationControlBar id=”AppControlBar” paddingTop=”0″ paddingBottom=”0″ width=”1391.2878″ height=”55.530304″
styleName=”MyApplicationControlBar” >
<mx:MenuBar id=”appMenuBar” labelField=”@label” width=”1380.303″ height=”41.060608″ fontWeight=”bold” fontSize=”12″
themeColor=”#E7790D” alpha=”1.0″ itemClick=”menuItemHandler(event)”>
<mx:XMLList>
<menuitem label=”Menu 1″>
<menuitem label=”Menu1 Sub Menu 1″ url=”modules\\m1submenu1.swf”>

<menuitem label=”Menu1 Sub Menu 2″ url=”modules\\m1submenu2.swf”>

</menuitem>

<menuitem label=”Menu 2″>
<menuitem label=”Menu2 Sub Menu 1″ url=”modules\\m2submenu1.swf”>

<menuitem label=”Menu2 Sub Menu 2″ url=”modules\\m2submenu2.swf”>

</menuitem>

</mx:XMLList>
</mx:MenuBar>
</mx:ApplicationControlBar>

<mx:Panel id=”applicationModulePanl” width=”1390″ height=”848.63635″ cornerRadius=”0″ backgroundColor=”#FDFDFD” borderStyle=”inset”>
<mx:ModuleLoader id=”loadModule” width=”1367.9546″ height=”802.803″ x=”20″ y=”9.1″ backgroundColor=”#FEFEFE”/>
</mx:Panel>

</mx:VBox>

</mx:Application>

How To Create Modules

1. Ur Project > Right Click > New Module .. Enter Name, Location as u wish .. dont forget to update in the url of the menu item …

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s