`
vu060vu
  • 浏览: 12633 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

ApplicationDomain

 
阅读更多

ApplicationDomain
2011年11月01日
  应用程序域有三种类型,系统域子域(新的应用程序域)、当前应用程序域、当前应用程序域的子域。他们的关系就像是这样。
  
  
  
  ApplicationDomain 类的用途是存储 ActionScript 3.0 定义表。SWF 文件中的所有代码被定义为存在于应用程序域中。可以使用应用程序域划分位于同一个安全域中的类。这允许同一个类存在多个定义,并且还允许子级重用父级定义。
  利用ApplicationDomain加载类定义的代码如下
  1. var urlRequest:URLRequest = new URLRequest(url);2. var loader:Loader = new Loader();3. var context:LoaderContext = new LoaderContext();4. //当前域5. context.applicationDomain = ApplicationDomain.currentDomain;6. //新应用程序域7. //context.applicationDomain = new ApplicationDomain();8. //当前域子域9. //context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);10. loader.load(urlRequest, context);
  当加载完成后我们可以像这样来使用加载的类定义
  1. //这里的ClassDefinitionName是我们在被加载的swf中的类定义的名称2. var AClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition(ClassDefinitionName) as Class;3. new AClass();下面就说说这三个不同的域
  1、当前域
  ApplicationDomain 类的用途是存储 ActionScript 3.0 定义表,在当前域中加载类定义后,如果当前域中已经有了同名的类定义,那么新加载的类定义不会覆盖原来的(这一点要注意),原来没有的会添加到as3的定义表中。
  这可让您将新的类定义添加到应用程序的当前一组类定义中。这可用于主应用程序的运行时共享库。加载的 SWF 被视为远程共享库 (RSL)。使用此方法可以在应用程序启动之前使用预加载器加载 RSL(运行时共享库)。
  2、新应用程序域
  在系统域中新建一个应用程序域,他和当前域是平级的。这样我们可以对相同名称的类,可以有两个完全不同的定义。
  此方法的一个用处是使旧版应用程序能够动态加载相同应用程序的更新版本,而不会发生冲突。之所以不发生冲突,是因为尽管使用的是同样的类名称,但它们划分到不同的应用程序域中。
  3、当前域子域
  在当前域中新建一个子域。这里也有一个要注意的,就是当父级域中(也就是当前域)没有同名的定义时,子域中的类才会被定义。
  此方法的一个用处可能是作为一个使用主应用程序的类型的多屏幕丰富 Internet 应用程序 (RIA) 模块,该模块作为主应用程序的子级加载。如果能够确保所有类始终更新为向后兼容,并且正在加载的应用程序始终比其加载的软件的版本新,则子级将使用父级版本。如果可以确保不继续拥有对子级 SWF 的引用,则拥有了新的应用程序域还使您能够卸载所有的类定义以便于垃圾回收。此方法使加载的模块可以共享加载者的 singleton 对象和静态类成员。
分享到:
评论

相关推荐

    applicationDomain学习资料

    applicationDomain学习资料

    深入理解ApplicationDomain和SecurityDomain

    深入理解ApplicationDomain和SecurityDomain

    ApplicationDomain的误解,安全沙箱有关内容

    ApplicationDomain的误解,安全沙箱有关内容

    详细介绍ApplicationDomain和SecurityDomain

    详细介绍ApplicationDomain和SecurityDomain的原理,想对这方面的知识做深入研究的可以看下

    Flex ApplicationDomain

    NULL 博文链接:https://luhantu.iteye.com/blog/1915935

    Modeling with UML

    and concepts for the application domain, criticality, and complexity of each system to be developed. Techniques for management of projects, configuration, variant and quality, as well as software ...

    Designing Reliable and Efficient Networks on Chips

    Developing NoC based interconnect tailored to a particular application domain, satisfying the application performance constraints with minimum power-area overhead is a major challenge. With technology...

    FDTD的并行算法论文

    implementation details or the application domain is given. The model is used to formalize the problem of optimal distribution of computational load to an arbitrary set of resources across a ...

    计算机专业词汇.txt

    app domain (application domain)应用域 application 应用、应用程序 application framework 应用程序框架 appearance 外观 append 附加 architecture 架构、体系结构 archive file 归档文件、存档文件 argument引数...

    AS3.0模块基础知识

    context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain); context.applicationDomain = ApplicationDomain.currentDomain; context.applicationDomain = new ApplicationDomain(); ...

    很强大.net逆向工具

    本工具能够属于reflector的升级版,可以嵌入牛X的插件做很多事情。

    Introduction to Parallel Algorithms - Arrays Trees Hypercubes

    Within each chapter, the material is organized according to the application domain, starting with the simple algorithms and advancing to the more complicated. Emphasis is placed on the paradigms and ...

    Adobe Flash Player for IE v11.3.300.265

    Adobe Flash Player(Flash Player官方下载)是一个集成的多媒体播放器,让你在Web上享受更广泛的多媒体体验。Adobe Flash Player官方版可显示和播放多媒体内容,从数以千计的高度...— ApplicationDomain.getQualifie

    SAD上机实验

    面向对象的系统分析和设计的主要目的是完成对某个特定应用论域(application domain)的分析和系统的建模。应完成的主要工作是描述系统中的对象、对象的属性和操作、对象的动态特性、对象间的构造关系和通信关系等,...

    系统分析与设计课件

    面向对象的系统分析和设计的主要目的是完成对某个特定应用论域(application domain)的分析和系统的建模。应完成的主要工作是描述系统中的对象、对象的属性和操作、对象的动态特性、对象间的构造关系和通信关系等,...

Global site tag (gtag.js) - Google Analytics