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 > > > On 4/1/08, Cedric Muller <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I did develop a global process, in which my customized objects do have a > > 'die' method which is called in the end of an object's life in order to > > clean *everything* (like removing internal movieclips, sprites, > listeners, > > timers, ..) > > > > this is what I came up with: the following block code is part of > > MyWhateverObject die method: > > > > // basicNews is some basic Repeater .... > > if (this.basicNews != null) { > > this.basicNews.removeEventListener(RepeaterEvent.CLICK, > > this.onNewsClicked); > > this.removeChild(this.basicNews); > > this.basicNews.die(); > > this.basicNews = null; > > } > > > > my question is the following: when would you call the basicNews.die() > > method ? BEFORE or AFTER the 'this.removeChild(this.basicNews)' ? > > > > tia, > > Cedric > > _______________________________________________ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > _______________________________________________ > 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