loading an RSL without using flex?

我的梦境 提交于 2019-12-03 21:27:28

This is a very tricky one, with lots to go into I'm afraid. Some pointers:

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.

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);

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....

This link on livedoc could be useful: Example on how to use ApplicationDomain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!