actionscript-3 - 记录调度自定义事件(在 ActionScript 3 中)

标签 actionscript-3 events documentation

假设我的 X 类能够调度 3 种类型的(自定义)事件。 我应该在类文件中的何处以及如何最好地记录此行为?

最佳答案

在类上方添加 [Event] 元标记。

Starling 框架的示例:

package starling.core
{

    /** Dispatched when a new render context is created. */
    [Event(name="context3DCreate", type="starling.events.Event")]

    /** Dispatched when the root class has been created. */
    [Event(name="rootCreated", type="starling.events.Event")]

    /** The Starling class represents the core of the Starling framework.
     *
     *  <p>The Starling framework makes it possible to create 2D applications and games that make
     *  use of the Stage3D architecture introduced in Flash Player 11. It implements a display tree
     *  system that is very similar to that of conventional Flash, while leveraging modern GPUs
     *  to speed up rendering.</p>
     *  
     *  <p>The Starling class represents the link between the conventional Flash display tree and
     *  the Starling display tree. To create a Starling-powered application, you have to create
     *  an instance of the Starling class:</p>
     *  
     *  <pre>var starling:Starling = new Starling(Game, stage);</pre>
     *  
     */ 
    public class Starling extends EventDispatcher
    {
        /** The version of the Starling framework. */
        public static const VERSION:String = "1.2";

关于actionscript-3 - 记录调度自定义事件(在 ActionScript 3 中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11712927/

相关文章:

C#转发接口(interface)事件

c# - 使用 "new EventHandler<T>"和不使用 new EventHandler<T> 的接线事件之间的区别?

c# - 无效的 XML 注释 : invalid character

actionscript-3 - 将帧同步到音频和 channel.position 精度

javascript - AS3 : How do I get dynamic loader URL from LoaderInfo in Event Listener Function?

actionscript-3 - 文本区域未正确更新,缺少字符

apache-flex - 如何在ActionScript 3 Sprite中绘制文本?

javascript - JavaScript 或 jQuery 可以检测事件传播何时完成吗?

C# 类库方法摘要未在智能感知中显示

php - 创建一个 "Table of Contents"类型的数据库