Is there a way to determine which event listeners are registered with a display object? I want to remove all event listeners from a display object so that I can assign new ones
jeceuyper is right ...
a side not though: DisplayObject
extends EventDispatcher
, which already does implement IEventDispatcher
... so to be more precise: you need to override addEventListener
and removeEventListener
to keep track of the listeners ...
a few technical details: i suggest you use Dictionary
to store the handler functions ... a bit slower for insertion, but much faster for removal ... also, Dictionary
supports weak references, which is quite important in the case of event handling ... also keep in mind, that useCapture
allows to add the same handler twice ...
good luck then ... ;)