Dear Friends, Is there some way where I can remove all event listeneres on my components all at once. Expecially when I dont have any prior knowledge of, what all listeners are being attached to my component.
Thanks in advance.
Dear Friends, Is there some way where I can remove all event listeneres on my components all at once. Expecially when I dont have any prior knowledge of, what all listeners are being attached to my component.
Thanks in advance.
No!
You might be able to mock something up with hasEventListener and willTrigger. But, there doesn't appear to be an obvious way to remove the event listeners without actually knowing the method name.
What do you want to do this for?
You can override mx.core.FlexSprite, which UIComponent inherets from, and generate an array of listeners created. Doug Mc Cune put up source code here.
His blog says: removeAllEventListeners() – removes all event listeners of all types. This completely wipes out all event listeners for the component all at once.
Let us know if this does the job!
There is an issue in Adobe JIRA for this task, please vote if you feel that it important for you
Elad Elrom has a post on his implementation to store event listener references, and be able to remove them all at once: