A.addEventListener(“someEvent”, B.someHandler) Adds a reference from A to B so that A can know the which object’s someHandler to call. If A and B are the same or B is a child of A it can’t cause a memory leak and thus the listener does not need to be removed. If A is a parent of B or is closer to a GC root than B then you can have problems.
No need to clean the poop out of the diaper if you are going to toss the whole diaper. On 6/2/10 3:57 AM, "Nick Middleweek" <[email protected]> wrote: Hi, I'm trying to get my head into the Flex (3) component architecure and am reading through the source code of mx.controls.DateField. I've noticed quite a calls (eight of them) to addEventListener but there are none to removeEventListener. Is it not important to clear up after yourself?... "It is a good idea to remove any handlers that will no longer be used. This removes references to objects so that they can be cleared from memory." - http://livedocs.adobe.com/flex/3/html/help.html?content=events_05.html So; when I create a DateField, a number of event handlers are attached to it, so if I remove that DateField from the stage, are the event handlers still attached and therefore the DateField is referenced by these handlers and therefore won't get GD'd ? Mmmm.... Cheers, Nick -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui

