I think Sam is right. The garbage collector won't collect objects until there are no references to them. If you don't use weak references you'll have to remove every listener first before the object can be garbage collected.
Removing an object from a container is only part of the story. Objects can exist when not on the display list or a child of a container. Paul. ----- Original Message ----- From: "Sam Lai" <[email protected]> To: <[email protected]> Sent: Tuesday, January 06, 2009 11:51 PM Subject: Re: [flexcoders] Re: Properly remove children >I think you need to use weak references when adding event listeners. > Set the last parameter of addEventListener to true when adding event > listeners. > > Alternately, you can remove event listeners when the forms are removed > using the removeEventListener function. > > The flex profiler is useful here too to see what's not being garbage > collected.. > > 2009/1/7 markgoldin_2000 <[email protected]>: >> Ok, here what I am getting. >> I have a container that I am adding different forms to at the run >> time. These forms are all based on the same class though. >> So, before I add a new form I am removing current form using: >> container.removeAllChildren(); >> each form when created is adding a custom event listener to a parent - >> the container. When a custom event is triggered every form that was >> created (regardless that it was removed after) gets this custom event >> to handle. >> >> >> --- In [email protected], "Manish Jethani" >> <manish.jeth...@...> wrote: >>> >>> On Wed, Jan 7, 2009 at 4:23 AM, markgoldin_2000 >>> <markgoldin_2...@...> wrote: >>> >>removeAllChildren >>> > Yes, that's what I use but I dont see objects being completely >>> > destroyed. >>> >>> Define "destroyed". >>> >>> Surely you see them go away? >>> >>> Manish >>> >> >> >> >> ------------------------------------ >> >> -- >> Flexcoders Mailing List >> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt >> Alternative FAQ location: >> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 >> Search Archives: >> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups >> Links >> >> >> >> > > ------------------------------------ > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Alternative FAQ location: > https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups > Links > > >

