-
1. Re: Timer - How to stop it?
kglad Jun 2, 2014 6:11 AM (in response to melfs)use clearInterval:
clearInterval(countdownInterval);
-
2. Re: Timer - How to stop it?
melfs Jun 2, 2014 6:16 AM (in response to kglad)Thank you! Where should I add it in my code ? Sorry for the question but this is my first time trying to do a game in Flash.
-
3. Re: Timer - How to stop it?
kglad Jun 2, 2014 6:30 AM (in response to melfs)you should always add it just before setting it. that prevents a major difficult-diagnose-problem that you have yet to encounter but almost certainly eventually will.
and you should add it when you want to stop the interval.
from my understanding of your setup, you only want that timer to execute once on each frame and you probably want it to stop when the user answers a question. so, you should use clearInterval when a user answers the question and when the countdown executes.
p.s. you can uset setTimeout for a timer that only executes, at most, once. that would eliminate the need to use clearTimerout in countdown, but you would still use it when the user answers a question.


