flash timer problemo!

Out of context: Reply #1

  • Started
  • Last post
  • 6 Responses
  • Bozilla0

    there's an anomaly with setInterval when you reuse the setInterval ID you created. You should delete that object after your clear the interval so if it starts again setInterval creates a new object alltogether.

    so after clearInterval(countID) you say:

    delete countID;

    also avoid writing callback functions under setInterval like that....create a separate function and then just call it by name from setInterval:

    in your case:
    DoSomething=function(){
    ...
    }
    countID=setInterval(DoSomething, 1000);

    much easier to maintain and edit..

View thread