views:

24

answers:

1

Hi,

I'm planning to break my Flex applications into different modules and need some advice regarding the loading of modules.

Currently, on load of the application, I need to add 5 modules as children to HGroups under a viewstack.

I'm using a ModuleManager to perform this and listens to the ModuleEvent to add the elements as IVisualElement under the HGroup.

Is there a way to add several modules without creating several IModuleInfo objects and multiple event listeners?

Please provide your inputs.

A: 

Here is the simplest way:

<mx:TabNavigator width="300" height="300">
    <mx:ModuleLoader url="com/sample/Module1.swf"/>
    <mx:ModuleLoader url="com/sample/Module2.swf"/>
    <mx:ModuleLoader url="com/sample/Module3.swf"/>
</mx:TabNavigator>

Code of Module1, all others are the same:

<mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:Label text="Module 1"/>
</mx:Module>
Maxim Kachurovskiy
Thanks for the help but I was actually looking for suggestions to load modules using ModuleManager and not ModuleLoader
whoopy_whale