问题描述
如果我已经推出自己的RSL,我想用它在我的纯AS3的应用程序,有没有文件或如何做到这一点的例子吗?
If I have rolled my own RSL, and I want to use it in my pure as3 apps, is there documentation or an example of how to do this?
或者我需要遍历Flex源$ C $ C弄清楚什么Adobe的工程师们做了什么?
Or do I need to traverse the flex source code to figure out what adobe's engineers have done?
推荐答案
这是一个非常棘手的,有很多进入我害怕。一些指点:
This is a very tricky one, with lots to go into I'm afraid. Some pointers:
要获得一个类从外部加载的SWF使用getDefinition方法上的一个应用领域,例如
To get a class from an externally loaded SWF use the getDefinition method on an application domain e.g.
public function loadHandler(evt:Event):void
{
var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
var clazz:Class = loaderInfo.applicationDomain.getDefinition("your.external.class");
}
这会给你的类定义,如果你知道你想要的类的名称。
This will give you the class definition if you know the name of the class you want.
要'加入'级域相互转化(以便应用程序可以编译针对深港西部通道,但不包括类,并将其装载外部),你需要指定同一个安全域的一个LoaderContext。
To 'join' class domains into each other (so applications can compile against a swc, but not include the classes and load them externally) you need to specify a loaderContext of the same security domain.
var loader:Loader = new Loader();
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
loader.load(new URLRequest("library.swf"), context);
第三指针我可以给你的编译器选项 - 外部库路径,用它来指定SWC的名单编译对时间检查,但不包括(在一个较低的文件大小)。
The third pointer I can give you is the compiler option "-external-library-path", use this to specify a list of swc's to compile time check against, but not include (resulting in a lower filesize).
mxmlc -source-path="dir/src" -external-library-path="dir/lib/framework.swc" --main.swf
抱歉,我不能细说更多,这是一个非常广阔的话题,希望这可以让你开始....
Sorry I couldn't elaborate more, it's a very expansive topic, hope this gets you started....
这篇关于不加载使用Flex RSL的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!