问题描述
我想知道如何以编程方式将库中的 MovieClip 添加到舞台上.
I am wondering how to add a MovieClip from the library onto the stage programmatically.
我该怎么做?
推荐答案
Flash 中的符号可以定义 ActionScript Linkage.
Symbols within Flash may define ActionScript Linkage.
AS 链接可以通过右键单击库中的符号并选择属性...
AS Linkage may be set by right-clicking a symbol from the library and selecting Properties...
选中 Export for ActionScript 并输入类名.
如果不需要显式定义符号类型以外的基类,可以直接从库中输入AS Linkage:
If you don't need to explicitly define a base class beyond the symbol type, you can enter AS Linkage directly from the Library:
这将创建一个与您编写 ActionScript 类没有什么不同的类定义.
This creates a class definition no different than if you had written an ActionScript class.
通过实例化您的 AS Linkage 类型的新实例来创建实例:
Create instances by instantiating new instances of your AS Linkage type:
var symbolExample:SymbolExample = new SymbolExample();
addChild(symbolExample);
这篇关于如何以编程方式将库中的 MovieClip 添加到舞台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!