Removing all event listeners in Flex

独自空忆成欢 提交于 2019-12-04 11:53:16

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!

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?

There is an issue in Adobe JIRA for this task, please vote if you feel that it important for you

https://bugs.adobe.com/jira/browse/SDK-14127

Elad Elrom has a post on his implementation to store event listener references, and be able to remove them all at once:

http://elromdesign.com/blog/2010/07/16/easy-way-to-store-event-listeners-reference-prevent-memory-leaks/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!