An interval ID is just a number. If you clear the interval, it doesn't
get rid of the number, it just stops the interval of that ID from running.
delete intervalID;
Helmut Granda wrote:
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