On Feb 23, 2007, at 4:45 PM, Alain Rousseau wrote:
If your interval is defined inside your Class then yes you will
need to
clear it or it will continue to run.
It is inside the class, and the class instance is created within that
movieclip after it's loaded via attachMovie().
On Feb 23, 2007, at 4:25 PM, Joey Rivera wrote:
My experience has taught me to always clear intervals when I'm done
with
them. Anyone correct me if I'm wrong, but to answer your question,
the
interval won't be cleared when you remove the movie clip. The
function will
still keep being called even if you can't see it since the movie
clip is no
longer being displayed. So you should clear the interval.
Joey
I was told by someone that since the intervals are in the global
namespace that yes, you do need to clear them or you'll "screw
yourself." Which this does make sense so I created a function to call
before I call removeMovieClip().
BTW, now that I'm thinking of it is it possible to do this?
private var myInterval:Number;
public function MyClass(mc:MovieClip) {
myMC = mc;
}
public function destroy():Void {
clearInterval(myInterval);
myMC.removeMovieClip();
}
myMC is a reference of the clip on stage that is blinking. Currently,
I call myClassInstance.destroy() and then blinkingMC.removeMovieClip
(). I assume it's possible to have removeMovieClip() in destroy()
since myMC is a reference of blinkingMC, correct?
Thanks.
Chris
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
ChrisRM
Sent: Friday, February 23, 2007 12:46 PM
To: [email protected]
Subject: [Flashcoders] Do You Need to Clear Intervals in this Case?
I have an AS class that accepts a movieclip in the constructor and
tells
that mc to blink via setInterval(). Now, this movieclip is in an
external
SWF and loaded into another using MovieClipLoader. So the movieclip is
loaded on stage and blinking. If I perform a removeMovieClip on that
blinking mc do I need to call a clearInterval before removing?
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com