来自外部SWF库的AS3加载符号 [英] AS3 load symbol from external swf library

查看:93
本文介绍了来自外部SWF库的AS3加载符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个SWF,其中1个(我们称其为Resources.swf)在其库中包含几个符号(其中大多数是MovieClips),但是没有一个被添加到舞台中(时间轴仅包含一个空框架), 然后是另一个swf(Main.swf),我需要从另一个SWF导入一些符号.

I have 2 SWF, one of them (let's call it Resources.swf), that contains several symbols (most of them MovieClips) on its library, but, none of them are added into the stage ( the timeline contains only one empty frame), and then, the other swf (Main.swf), where I need to import some of the symbols from the other SWF.

我一直在环顾四周并进行搜索,但是我看到并尝试过的所有信息,都使用以下方式从舞台/时间轴导入了符号:

I have been looking around, and searching, but all the info that I saw, and tried, imports the symbols from the stage/timeline using things like:

loadedMC = MovieClip(loader.content);

loadedMC = MovieClip(event.target.content);

我的符号具有类定义,因为它们也以这种方式用在其他swf中:

My symbols have a class definition, because, they are also used in other swf this way:

[Embed(source='assets/Resources.swf', symbol='SymbolName')]
public class Generic2 extends MovieClip

有什么办法吗?

如果没有,我是否需要修改Resources.swf来解决此问题,或者还有其他选择吗?

If not,do I have modify my Resources.swf to work this out or do I have other alternatives?

推荐答案

在加载Resources.swf之后,您可以创建已加载类的实例.

After loading the Resources.swf you can create instances of the loaded classes.

下面的代码片段可能会有所帮助:

Here a snippet that may help:

var dynClass : Class = Class(getDefinitionByName("fully.qualified.ClassName"));
if(dynClass) 
{
    var app : Object = new dynClass();
    addChild(app as DisplayObject);
}

这篇关于来自外部SWF库的AS3加载符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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