关于flash/flex的程序域
subject of application domain of flash and air.
在flash或flex中,程序加载外部swf文件,该文件的程序域默认为主程 序域的一个子域中。比如你使用A.swf加载B.swf文件,B被加载后,成为A程序域的一个子域,子域是申明类的时,不能覆盖父类已申明类:如果A中定 义了类com.sogou.Map类,同时B中也定义了com.sogou.Map类,但是当B加入到A的程序域时,先检查A程序域中是否已存在一个类。 如果存在,则使用该已存在类,否则申明属于B子程序域的类。当然也可以将B不加载到默认域中,而是新建一个域:
var loader:Loader = new Loader();
var context:LoaderContext = new LoaderContext();
context.applicationDomain = new ApplicationDomain();
loader.load(new URLRequest(”B.swf”), context);
同时,A可以使用B程序域中的类:
var bDomain:ApplicationDomain = loader.contentLoaderInfo.applicationDomain;
if (bDomain.hasDefinition(”com.sogou.map::JustForB”)) {
//判断一个程序域中是否已定义一个类
var bc:class = bDomain.getDefinition(”com.sogou.map::JustForB”) as class;
var bcInst:Object = new bc();
}
然后便可使用在B中定义的类JustForB类。当然B亦可使用A程序域中的类,前提是B的域为A程序域的一个子域,B可以直接使用。
再就是,将B加载加入到当前程序域中:
var loader:Loader = new Loader();
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
loader.load(new URLRequest(”B.swf”), context);
此时A和B的可以直接使用任何方所定义的任何类了(当然后定义的类不能覆盖先定义的类,即B中的com.sogou.map.Map不能覆盖A中的com.sogou.map.Map,二者任何地方使用的Map类都将来自A的定义。)
相关文档:
注:第一列是带Checkbox的Tree。
还有问题请教各位:
labelField是元素对象的属性是显示不了(carInfo.car_name),好像只可显示同级的属性怎么解决?希望各位能帮助我,Thanks!
<mx:AdvancedDataGrid id="adg" width="100%" height="100%" dataProvider="{instance.cars}"
&n ......
1、使用navigateToURL,主要方式如下:var url:String = "http://localhost:8080/Flex_J2eeDemo/bin/Welcome.html";
&n ......
Flex端代码:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
>
<fx:Script>
<!--[C ......
在PowerPoint幻灯片中插入Flash方法一
将扩展名为. SWF的Flash动画文件插入PPT
---插入一个由文件创建的对象
---在“动作设置”中的“对象动作”选项中选择“激活内容”
在PowerPoint幻灯片中插入Flash方法二
利用Active X控件插入动画
---选择“视图&rd ......