|
-
Bearded (M|G)od
just push the timers into an array, then loop through the array to clear them all:
Code:
var timers:Array = new Array();
var i:Number = setInterval(....);
timers.push(i);
function clearAllIntervals(a:Array):Void
{
for(var i:Number=0; i<a.length; i++)
{
clearInterval(a[i]);
}
}
with that function, you can then just call, clearAllTimers(timers); and it will do the job.
-
The advantage to the code that I posted is that it doesn't require any changes to your current code. You can simply drop the function in and it will clear out all of the intervals. Of course, your way is probably cleaner, but sometimes nuking everything can be useful. :-)
Also, how funny is it that this thing went dead for 5 years, then I replied and within 1 hour someone else replied? Crazy. Sorry to bring back an old thread, but it turned out to be applicable to my current problem (I stumbled across this forum through a Google search for the solution).
Last edited by Phoenix00017; 08-07-2007 at 03:21 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|