There are 2 options:
- Or you don't use removeEventListener and make sure that you use a weak reference when doing addEventListener (setting the 5th parameter of addEventListener to true)
- Or you attach event listeners in the "addedToStage" event and you remove them again in the "removedFromStage" event
Why Adobe didn't set the 'weak reference' parameter by default to 'true' is unclear to me. The current situation is probably one of the major causes of memory leaks in Flex applications...
No comments:
Post a Comment