`
xo_tobacoo
  • 浏览: 385657 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

SWFLoader和Loader的区别

阅读更多

 

可以使用SWFLoader和Loader两个类来加载子应用程序,多数情况下我们使用SWFLoader。它是Loader的一个包装类,提供了很多附加功能,使加载子应用程序更简单。

SWFLoader有如下特征:

 

支持flex的样式和特效;而Loader类却不支持任何固有的样式和特效。

方便管理加载进度;如果使用Loader则首先要获取LoaderInfo引用。

 

是一个UIComponent组件。SWFLoader它自己管理了所有子显示对象,不需要添加多余的代码。

自动缩放显示内容的大小

 

可以加载Application以外的实现类,如果检测到不是一个Application,会自动进行处理。

可以处理不同的版本。Loader不支持加载不同的编译版本

 

当使用Loader加载不是受信任区域的swf时,必须提供一个遮罩来重新定位,否则它会显示在屏幕外面:

 

import flash.display.*;
import flash.net.URLRequest;
var rect:Shape = new Shape();
rect.graphics.beginFill(0xFFFFFF);
rect.graphics.drawRect(0, 0, 100, 100);
addChild(rect);
var ldr:Loader = new Loader();
ldr.mask = rect;
var url:String = "http://www.unknown.example.com/content.swf";
var urlReq:URLRequest = new URLRequest(url);
ldr.load(urlReq);
addChild(ldr);
 

 

原文:

 

 

You can use the SWFLoader and Loader classes to load sub-applications into a main application. In most circumstances, use the SWFLoader class. This class wraps the Loader class and provides additional functionality that makes it easier to use for loading sub-applications into main applications.

The SWFLoader control has the following features:

Supports Flex styles and effects; the Loader class does not have any inherent support for styles and effects.
Lets you monitor the progress of a load inherently (if you use the Loader class, you have to first get a reference to a LoaderInfo object).
Is a UIComponent. As a result, the SWFLoader control participates in the display list and adds children to the display list without having to write additional code.
Resizes and scales the contents automatically.
Does not require that the SWF file be an instance of the Application class, it just checks if an Application exists, and handles sizing differently.
Can be multi-versioned. The Loader class does not have built-in support for multi-versioning.
0
0
分享到:
评论

相关推荐

    swfloader:swf加载器,用于在flex中加载swf文件。可用于组件模块化,加载然后反射得到相应类

    #swfloader加载器 用于在flex中缓存加载swf文件。 可用于组件模块化加载。加载完成的组件,下次加载可直接从SWFCache中根据url获取相应内容,避免重复加载 单个加载方式 var item:SWFItem = new SWFItem(); item.url...

    SWFLoader源代码

    用来加载位图,需要将图片先导入FLASH,放在SWF类远见中。然后通过此类读取。

    Tree与SWFLOAD

    实现了树与swfloader结合,动态显示图片

    FLEX企业应用开发实战.part1

     3.2.4 通过SWFLoader加载Application  3.2.5 域及跨域访问  3.3 Flex Module  3.3.1 创建模块  3.3.2 模块的编辑与编译  3.3.3 模块文件的加载  3.3.4 主应用和模块的交互  3.4 Flex库文件SWC  ...

    FLEX企业应用开发实战.part2

     3.2.4 通过SWFLoader加载Application  3.2.5 域及跨域访问  3.3 Flex Module  3.3.1 创建模块  3.3.2 模块的编辑与编译  3.3.3 模块文件的加载  3.3.4 主应用和模块的交互  3.4 Flex库文件SWC  ...

    flex3的cookbook书籍完整版dpf(包含目录)

    使用SWFLoader载入SWF 2.5节. 设置组件的标签索引 2.6节. 设置控件的labelFunction 2.7节. 提供菜单数据 2.8. 动态填充菜单 2.9节. 为菜单类控件创建事件处理函数 2.10节. 显示一个通知窗口 2.11节. 使用Calendar...

    Flex企业应用开发实战源代码

    3.2.4 通过SWFLoader加载Application 97 3.2.5 域及跨域访问 99 3.3 Flex Module 101 3.3.1 创建模块 102 3.3.2 模块的编辑与编译 104 3.3.3 模块文件的加载 104 3.3.4 主应用和模块的交互 107 3.4 Flex库...

Global site tag (gtag.js) - Google Analytics