帮助了解 Flex 中的凯恩戈姆事件
我正在阅读 David Tucker 的这篇文章 (http://www .davidtucker.net/2007/10/29/cairngorm-part-3/),其中他谈论了凯恩戈姆事件。
这里有两件事想问一下-
用事件arg调用父类的构造函数有什么意义?示例中的super(LOGIN)
为什么需要重写clone方法?
了解这些事情将使我更好地了解 Cairngorm 的工作方式。
谢谢
I was going through this article by David Tucker (http://www.davidtucker.net/2007/10/29/cairngorm-part-3/) in which he talks about Cairngorm Events.
There are two things that I want to ask in this-
What is the significance of calling the constructor of the parent class with the event arg? super(LOGIN) in the example
Why do you need to overrride the clone method?
Understanding these things will give me a better insight into the way things are done with Cairngorm.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这两个问题都不是凯恩戈姆事件所特有的。这是 AS3 事件的标准机制。
Cairngorm 事件继承自 Event,Event 类需要一个“type”字符串。这就是为什么您需要在构造函数中指定它。
创建自定义事件类时,需要重写clone方法。当您想要重新分派自定义事件的实例时,Flash Player 会自动调用此方法。
Both questions are not specific to Cairngorm events. This is standard mechanism for AS3 events.
Cairngorm events inherit from Event and Event class requires a "type" string. That's why you need to specify it in the constuctor.
When creating a custom event class, you need to override the clone method. This method is automatically called by the Flash Player when you want to re-dispatch an instance of a custom event.