Search code examples
flashactionscript-3eventsevent-handlinglisteners

Flash AS3 EventDispatcher - any way of getting a list of registered listeners?


Is there any way of getting a list of registered listeners for an EventDispatcher?

I know that EventDispatcher has the hasEventListener method to tell you if any listeners are registered, but is there an easy way of interrogating the EventDispatcher to find out what the listeners are?

One way I figured to do this was to subclass EventDispatcher to override the addEventListener method and store the listeners in a dictionary, but this feels clunky to me.

Any ideas?


Solution

  • Ok, so it seems that there is no answer to this question other than my original idea of storing listeners in a Dictionary and removing them explicitly. Oh well...

    Some interesting thoughts about the intricacies AS3 Events system can be found here.