Re: [Flashcoders] Best MovieClip removal practice

2010-01-06 Thread Juan Pablo Califano
general case, using those events simplifies the interface (meaning, the user of the class doesn't have to bother calling a destroy method, etc). Cheers Juan Pablo Califano -- Forwarded message -- From: Matt S. Date: 2010/1/6 Subject: Re: [Flashcoders] Best MovieClip removal pra

Re: [Flashcoders] Best MovieClip removal practice

2010-01-06 Thread Juan Pablo Califano
Running a GC cycle is rather intensive and can definitely have an impact on performance. It's a trade-off. You hold some memory for a little longer than you actually need, but you save on performance (and many times, memory is just sitting there with no one using it anyway... also, allocating and d

Re: [Flashcoders] Best MovieClip removal practice

2010-01-06 Thread Matt S.
On Wed, Jan 6, 2010 at 6:15 PM, Karl DeSaulniers wrote: > So there is no way to fire the garbage collector from actionscript? > This seems odd to me if that is the case. If the flash applications > performance is dependent partly on how well the garbage is taken out, > wouldn't there be a class ma

Re: [Flashcoders] Best MovieClip removal practice

2010-01-06 Thread Karl DeSaulniers
So there is no way to fire the garbage collector from actionscript? This seems odd to me if that is the case. If the flash applications performance is dependent partly on how well the garbage is taken out, wouldn't there be a class made for that so we can control it? Or is it too risky to be m

Re: [Flashcoders] Best MovieClip removal practice

2010-01-06 Thread Henrik Andersson
Event listeners will be destroyed along with the object the listeners belong to. But they will keep on firing until the garbage collector feels like running. Do note that a listener does hold a reference to the listener function from the event source. This means that if the object has a listen

Re: [Flashcoders] Best MovieClip removal practice

2010-01-06 Thread Matt S.
Not only is it better, but definitely best practice. The most basic method is to include a listener destroyer function within the class so that it can deactivate itself before being removed, eg: SomeMovieClip.destroyMe(); removeChild(SomeMovieClip); SomeMovieClip = null; there are fancier ways to

Re: [Flashcoders] Best MovieClip removal practice

2010-01-06 Thread Karl DeSaulniers
Could you do? SomeMovieClip.removeListener(someListener); removeChild(SomeMovieClip); SomeMovieClip = null; No need to wait for the trash man. Again, I am still thinking in AS2. Not sure of AS3 equivalent. Karl Sent from losPhone On Jan 6, 2010, at 4:19 PM, ktt wrote: Hello, After remov

[Flashcoders] Best MovieClip removal practice

2010-01-06 Thread ktt
Hello, After removeChild(SomeMovieClip); SomeMovieClip = null; it will removed and will wait for garbage collector. But maybe it is better to remove most unwanted listeners before nullifying the MovieClip and not wait for garbage collector? It should save some memory space and time for actually