I have an object with about 6 different event listeners attached to it.
Normally when I delete that object I would add code to remove those 6 listeners so it could be garbage collected.
To save me typing out all the removeEventListener code can I simply add weak references in the beginning ?
Is there any disadvantage in doing this ?
Thanks for any advice.
You may not even need to do that.
If there is an object A and B and C are listening to it:
There are no references from B or C to A so those listeners don't have to be removed. It turns out that A has references to B and C's fooHandler, not the other way around.
You can use weak reference listeners, but they have slightly higher overhead and don't get gc'd as often, and can cause intermittent errors if they don't get gc'd when you want them to.
Flex SDK Developer
Adobe Systems Inc.