• Module切换,如何实现loading效果


    Flex里面没有那么麻烦的
    1. <mx:ProgressBar source="msgEditor"/>
    2. <mx:ModuleLoader id="msgEditor" url="view/contactPanel.swf"/>
    复制代码
    即可
    如何使用代码,Flex里有ModuleManager
     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.");
       }
  • 相关阅读:
    Linux PHP连接MSSQL
    Curl参数一览
    [android开发必备] Android开发者社区汇总
    android定时器
    一个mysql小技巧
    php empty问题
    周报_2012第16周(2012/04/152012/04/21)
    周报_2012第17周(2012/04/222012/04/28)
    周报_2013第04周(2013/01/202013/01/26)
    周报_2013第01周(2012/12/302012/01/05)
  • 原文地址:https://www.cnblogs.com/jiahuafu/p/1609263.html
Copyright © 2020-2023  润新知