加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex LoadManager

发布时间:2020-12-15 05:03:19 所属栏目:百科 来源:网络整理
导读:ModuleEvent 公共常量 ?1、? ERROR : String = "error"? ?下载模块出错时调度。? ? 2、PROGRESS : String = "progress"? ? 下载模块的过程中调度。? ? 3、READY : String = "ready"? ?? 模块完成下载时调度。? ??4、SETUP : String = "setup"? ??? 已下载了

ModuleEvent

公共常量

?1、? ERROR : String = "error"?
?下载模块出错时调度。?
? 2、PROGRESS : String = "progress"?
? 下载模块的过程中调度。?
? 3、READY : String = "ready"?
?? 模块完成下载时调度。?
??4、SETUP : String = "setup"?
??? 已下载了足够的模块内容,您可以获得有关模块的信息时调度。
? 5、? UNLOAD : String = "unload"?
?????卸载模块时调度。

?

 import mx.events.ModuleEvent;
   import mx.modules.ModuleManager;
   import mx.modules.ModuleLoader;
   import mx.modules.IModuleInfo;
   
   protected var _moduleInfo:IModuleInfo;
   public function init():void
   {
    
    _moduleInfo = ModuleManager.getModule("testM.swf");
               // add some listeners
               _moduleInfo.addEventListener(ModuleEvent.READY,onModuleReady);
               _moduleInfo.addEventListener(ModuleEvent.SETUP,onModuleSetup);
               _moduleInfo.addEventListener(ModuleEvent.UNLOAD,onModuleUnload);
               _moduleInfo.addEventListener(ModuleEvent.PROGRESS,onModuleProgress);
   
   
    _moduleInfo.load();
    //var m1:ModuleLoader = new ModuleLoader();
    //m1.url="testM.swf";//url指向modOne.mxml
          //m1.loadModule();//发出指令调用模块
          
          //this.addChild(m1);
    //url="testM.swf" width="800" height="600"
    
   }
   
   //加载完成
   public function onModuleReady(e:ModuleEvent)
   {
    trace("ready");
    
    // cast the currentTarget
                var moduleInfo:IModuleInfo = e.currentTarget as IModuleInfo;
                // Add an instance of the module's class to the 
                // display list. 
                trace ("Calling IModuleInfo.factory.create ()");
                this.addChild( moduleInfo.factory.create () as testM);
                trace ("SomeModule instance created and added to Display List");
   }
   //获取相关的模块信息   
   public function onModuleSetup(evt:ModuleEvent)
   {
    trace("setup");
   }
  //卸载模块 
   public function onModuleUnload(evt:ModuleEvent)
   {
    trace("UNLOAD");
   }
    //加载进度   
   public function onModuleProgress(event:ModuleEvent)
   {
    //trace("PROGRESS");
    trace("ModuleEvent.PROGRESS received: " + event.bytesLoaded + " of " + event.bytesTotal + " loaded.");
   }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读