在不使用 flex 的情况下加载 RSL? [英] loading an RSL without using flex?

查看:45
本文介绍了在不使用 flex 的情况下加载 RSL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我推出了自己的 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 源代码才能弄清楚 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.

要将类域相互加入"(以便应用程序可以针对 swc 进行编译,但不包括类并从外部加载它们),您需要指定相同安全域的 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);

我可以给你的第三个指针是编译器选项-external-library-path",用它来指定要编译时检查的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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆