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 based on context changes in the application.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
jeceuyper is right …
a side not though:
DisplayObjectextendsEventDispatcher, which already does implementIEventDispatcher… so to be more precise: you need to overrideaddEventListenerandremoveEventListenerto keep track of the listeners …a few technical details: i suggest you use
Dictionaryto store the handler functions … a bit slower for insertion, but much faster for removal … also,Dictionarysupports weak references, which is quite important in the case of event handling … also keep in mind, thatuseCaptureallows to add the same handler twice …good luck then … 😉