So once you create a new interval with the same name you will lose the path of the original?
/*SAMPLE Of course we know this is not the way to do it ;) Its just for testing purposes */ var myInterval:Number = setInterval (this, "test", 1000); var myInterval:Number = setInterval (this, "test", 1200); var myInterval:Number = setInterval (this, "test", 1400); var myInterval:Number = setInterval (this, "test", 1600); clearInterval (myInterval); function test() { trace("hi"); } In this case we now don't have access to interval 1,2 and 3 and of course 4 was cleared. ...helmut On 4/24/07, Muzak <[EMAIL PROTECTED]> wrote:
clearInterval stops an interval from executing, it doesn't remove the ID that was assigned to the interval. >From the docs: <quote> setInterval: Returns Number - An integer that identifies the interval (the interval ID), which you can pass to clearInterval() to cancel the interval. </quote> Each time you call setInterval a numeric identifier is returned, which is auto incremented as you can see in your example. And this also explains why it is so important to clear an interval before creating a new one, which was mentioned a few times here recently. regards, Muzak ----- Original Message ----- From: "Helmut Granda" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com> Sent: Tuesday, April 24, 2007 11:18 PM Subject: [Flashcoders] Clear Set Interval Q: > Is there any specific reason why after calling clearInterval the variable > with the interval returns 1 instead of undefined/null? > > Following the docs and creating a simple item we get different results (no > different but no what our logic might expect) > > function callback() { > trace("interval called: "+getTimer()+" ms."); > } > > var intervalID:Number = setInterval(callback, 1000); > trace(intervalID); > > clear_btn.onRelease = function(){ > clearInterval( intervalID ); > trace(intervalID);//shouldnt this return undefined/null? > trace("cleared interval"); > }; > > start_btn.onRelease = function() { > intervalID = setInterval(callback, 1000);// this adds 1 to the current > interval > trace(intervalID); > } _______________________________________________ Flashcoders@chattyfig.figleaf.com 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
_______________________________________________ Flashcoders@chattyfig.figleaf.com 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