Use ModuleManager to manage swf file : ModuleManager « Development « Flex






Use ModuleManager to manage swf file

Use ModuleManager to manage swf file
          

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="preloadModules()">
  <mx:Script>
    
    import mx.events.ModuleEvent;
    import mx.modules.ModuleManager;
    import mx.modules.IModuleInfo;
    private function preloadModules():void {
      var info:IModuleInfo = ModuleManager.getModule("a.swf");
      info.addEventListener(ModuleEvent.READY, modEventHandler);
      info.load();
    }
    private function modEventHandler(e:ModuleEvent):void {
      trace("module event: " + e.type);
    }
  </mx:Script>
  <mx:Panel title="Module Example">
    <mx:TabNavigator id="tn" width="100%" height="100%" creationPolicy="auto">
      <mx:VBox id="vb1" label="Module A">
        <mx:Label id="l1" text="a.swf" />
        <mx:ModuleLoader url="a.swf" />
      </mx:VBox>
      <mx:VBox id="vb2" label="Module B">
        <mx:Label id="l2" text="a.swf" />
        <mx:ModuleLoader url="a.swf" />
      </mx:VBox>
    </mx:TabNavigator>
  </mx:Panel>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Report level of completion during the module's loading processReport level of completion during the module's loading process