Flex 4 load multiple modules in sequence
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 unde开发者_JAVA技巧r 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.
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>
精彩评论