EventManager Class Update

Hate keeping track of event listeners?

Wish you had removeAllListeners()?  Wish you had removeAllListeners(EventDispatcherWithABunchOfListeners)? Wish you could remove all listeners that targetted a specific function?

A while ago I posted a class I wrote to handle actionscript 3 listeners.

I updated EventManager.as today to by default set weakReference to true and to always add the listener (if you used it before it might break code that didn’t declare the last parameter).

The class has come in handy in so many projects and makes code much nicer. It’s especially useful for destroying all the listeners of an external SWF…

Find the latest version here.

Note that the class doesn’t have full support for listeners with useCapture specified… but who really uses those anyway?

3 thoughts on “EventManager Class Update”

  1. This is a really great idea. I like the default value of true for useWeakReference. Adobe should have at least put that param in the 3rd position of addEventListener…

    thanks for the source.

Leave a Reply

Your email address will not be published.