zoukankan      html  css  js  c++  java
  • 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.");
       }
  • 相关阅读:
    自定义一个运行时异常
    对象的知识点正确解释
    decimal模块
    B+树
    Web框架系列之Tornado
    初识git
    Mysql表的操作
    MySQl创建用户和授权
    MySql安装和基本管理
    为什么用Mysql?
  • 原文地址:https://www.cnblogs.com/jiahuafu/p/1609263.html
Copyright © 2011-2022 走看看