There are times when I need to listen to an object’s event for just a single dispatch and then be done with the listener. When I’m faced with this situation I tend to want to define the event handler as a closure or an anonymous function as opposed to adding yet another class method to handle the dispatch. A complication with this approach comes from the fact that I also want to explicitly remove my event listeners for the sake of good garbage collection. So, to have my cake and eat it to I created a proxy class that takes care of listening to the event and cleaning up after itself once the event has been handled.
An ActionScript Proxy Event Dispatcher
Reply