package net.lanelife.framework.catwindows.core
{
import flash.events.ProgressEvent;
import flash.system.ApplicationDomain;
import mx.core.FlexGlobals;
import mx.events.ModuleEvent;
import mx.modules.IModuleInfo;
import mx.modules.ModuleManager;
import net.lanelife.framework.catwindows.utils.ProgressBar;
[Bindable]
public class Application
{
public var name:String;
public var moduleUrl:String;
private var module:IModuleInfo;
private var progressBar:ProgressBar;
public function run():void
{
module = ModuleManager.getModule(moduleUrl);
module.addEventListener(ModuleEvent.READY, module_readyHandler);
module.addEventListener(ModuleEvent.PROGRESS, module_progressHandler);
module.addEventListener(ModuleEvent.ERROR, module_errorHandler);
if (module.loaded)
{
start();
}
else
{
progressBar = new ProgressBar();
module.load(ApplicationDomain.currentDomain);
}
}
private function start():void
{
//trace("========"+module.url)
var application:IApplication = module.factory.create() as IApplication;
FlexGlobals.topLevelApplication.addElement(application);
application.run();
module.unload();
}
private function module_readyHandler(event:ModuleEvent):void
{
event.target.removeEventListener(ModuleEvent.READY, module_readyHandler);
event.target.removeEventListener(ModuleEvent.PROGRESS, module_progressHandler);
event.target.removeEventListener(ModuleEvent.ERROR, module_errorHandler);
progressBar.close();
start();
}
private function module_progressHandler(event:ModuleEvent):void
{
//trace(module.url)
progressBar.progress(event as ProgressEvent, "正在加载"+name+",请稍候...");
}
private function module_errorHandler(event:ModuleEvent):void
{
event.target.removeEventListener(ModuleEvent.READY, module_readyHandler);
event.target.removeEventListener(ModuleEvent.PROGRESS, module_progressHandler);
event.target.removeEventListener(ModuleEvent.ERROR, module_errorHandler);
progressBar.showError(name+"加载失败:"+event.errorText);
}
}
}
模块加载代码,用法:
loginApplication = new net.lanelife.framework.catwindows.core.Application();
loginApplication.name = "登录程序";
loginApplication.moduleUrl = "os/software/net/lanelife/webos/soft/login/Login.swf";
loginApplication.run();
分享到:
相关推荐
避免Flex RSL重复load 提高module加载性能的swc
Linux中的可加载模块(Module)分析
nginx-rtmp-module-master源码
Flex 加载 Module 模块开发 利用客户端缓存 Module 降低交互时间 这是一个DEMO
模块2解决方案
WordPress外贸企业主题Module开心版[更新至V4.5.4],Module主题采用全新模块化开发,首页模块可视化拖拽自由组合,可自定义搭建出不同行业适用的企业网站。同时主题全面支持WPML多语言切换,可轻松搭建外贸网站。 ...
flex中moduleLoader动态加载module时传递参数源代码
JS错误Uncaught SyntaxError: ...在报错中了解到,是说无法在模块外部使用import语句,因为Module 的加载实现的是es6语法,所以在浏览器加载html文件时,需要在script 标签中加入type=”module”属性。 解决办法:
主要介绍了解决vue动态路由异步加载import组件,加载不到module的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
主要介绍了Python自动重新加载模块详解(autoreload module),具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
requireJs源码,下载源码可以用来学习require的加载原理和加载机制;学习require模块加载的思想有利于了解ES6的Module加载原理
ThreadX Modules动态应用加载官网中文用户手册
weex android实现本地图片加载image播放gif动画扩展module获取版本号 博客地址:http://blog.csdn.net/codingandroid/article/details/77719557
不知道在什么时候,Linux出现了module这种东西,...Module可以允许我们动态的改变kernel,加载device driver,而且也能缩短我们driver development的时间。这篇文章里,我将要介绍一下module的原理及如何写一个module。
ngx_http_dav_ext_module.so centos7 nginx 1.18 可以作为模块加载
combyne, 使用你期望的方式的模板引擎 稳定:2.0.0无依赖关系。可以作为浏览器全局,AMD MODULE 和 node MODULE 加载。 使用 Browserify 。可以通过NPM或者 Bower 安装。Combyne在以下方面非常出色:
ng-image-appear, AngularJS MODULE 用于使图像在加载时具有过渡效果 ng-image-appear AngularJS MODULE 用于使图像在加载时具有过渡效果。包装包装器中的img 标记并在。 没有更丑陋的逐渐加载图像 !...
Spck模块是一个轻量级的脚本加载库。 入门 Spck模块可以使用Bower安装: bower install spck-module 首先将文件包含在您的主HTML文件中。 < script src =" spck-module.js " type =" text/javascript " > &...
:lizard: ->转移-> :T-Rex...一种用于“ esm”(现代)浏览器,可以使用type=module加载 另一个用于“旧”(旧版)浏览器,您可以使用nomodule加载 用法 1.将代码编译为modern目标,并将其称为“基准”。 首选 { " pr