thanks,cool thread. Now I have to drink some coffee, become less confused and let it sink in :)
On Wed, Apr 2, 2008 at 9:15 PM, EECOLOR <[EMAIL PROTECTED]> wrote: > >granted that the eventListener was added with a weak reference > > This seems to be one of the biggest mis-understandings these days. The > listener does *not*add a reference to the object that you are > listening too. For extensive discussion and proof of this issue you > can read the following thread: > > > > http://www.mail-archive.com/flashcoders@chattyfig.figleaf.com/msg38700.html > > In short: adding a listener to an object will only create a reference from > the object to the listener, not the other way around. This means that you > can remove the object without removing the listener, the object will then > still be garbage collected. > > > Greetz Erik > > > On 4/2/08, Meinte van't Kruis <[EMAIL PROTECTED]> wrote: > > > > granted that the eventListener was added with a weak reference > > > > On Wed, Apr 2, 2008 at 3:35 PM, EECOLOR <[EMAIL PROTECTED]> wrote: > > > > > *if (this.basicNews != null) { > > > > > this.basicNews.removeEventListener(RepeaterEvent.CLICK, > > > this.onNewsClicked); > > > this.removeChild(this.basicNews); > > > this.basicNews.die(); > > > this.basicNews = null; > > > }* > > > > > > In the above code I do not see why you would need any more then the > > > following lines: > > > > > > *basicNews = null; > > > removeChild(basicNews);* > > > > > > All references to basicNews are now removed and it is (along with its > > > children) marked for garbage collection. Calling the other extra > methods > > > seems a waste of CPU. > > > > > > > > > Greetz Erik > > > > > > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- M.A. van't Kruis http://www.malatze.nl/ _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders