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

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

问题描述

在Flex中,是否可以监听一个$ code> 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天全站免登陆