Report level of completion during the module's loading process : ModuleManager « Development « Flex






Report level of completion during the module's loading process

Report level of completion during the module's loading process
          
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    
    import mx.events.ModuleEvent;
    import flash.events.ProgressEvent;
    import mx.modules.*;
    [Bindable]
    public var progBar:String = "";
    [Bindable]
    public var progMessage:String = "";
    private function progressEventHandler(e:ProgressEvent):void {
      progBar += ".";
      progMessage =Math.round((e.bytesLoaded/e.bytesTotal) * 100) + "%";
    }
    public function createModule():void {
      chartModuleLoader.loadModule();
    }
  </mx:Script>
  <mx:Panel title="Module Example" height="90%" width="90%">
    <mx:HBox>
      <mx:Label id="l2" text="{progMessage}" />
      <mx:Label id="l1" text="{progBar}" />
    </mx:HBox>
    <mx:Button label="Load" click="createModule()" />
    <mx:ModuleLoader id="chartModuleLoader" url="a.swf" progress="progressEventHandler(event)" />
  </mx:Panel>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Use ModuleManager to manage swf fileUse ModuleManager to manage swf file