侦听 EventDispatcher 的所有事件类型 [英] Listen to all event types of an EventDispatcher

查看:25
本文介绍了侦听 EventDispatcher 的所有事件类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Flex 中,是否可以监听 IEventDispatcher 对象的所有事件类型?addEventListener 的第一个参数是类型,是一个字符串.在许多情况下,文档并不清楚它会触发什么事件类型.我想附加一个通用侦听器来检查事件.

In Flex, is it possible to listen to all event types of an object that's an IEventDispatcher? addEventListener's first parameter is the type, which is a string. In many cases the documentation is not clear what event type it fires. I'd like to attach a generic listener to inspect the events.

推荐答案

我认为你必须从这个类派生并像这样覆盖 dispatchEvent 方法:

I think you have to derive from this class and override the dispatchEvent method like this:

override public function dispatchEvent(event:Event):Boolean
{
    trace(event.type);
    return super.dispatchEvent(event);
}

这篇关于侦听 EventDispatcher 的所有事件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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