In the reference doc, I see there is Timer.pauseAll() and Timer.resumeAll(). But what if I want to pause an individual timer? I tried stop/start, it does not work
The console should output the count, press the mouse down in the player to call the stop() function and release it to call start() which will resume where it was stopped.
In your example there's no need to stop or start the timer. If you remove timer:stop and timer:start it will run as you expect.
If at this point you wanted to do something that will take some time then I'd suggest stopping the timer as you have, calling the function and then broadcast an event to start the timer again once the work has been completed.
Comments
Can you try this code:
Likes: ar2rsawseen
My code looks like this:
After the timer counts 10 timers with an interval of 1 second, the code stops counting and do some processing jobs
The problem happens when the next timer:start() starts the timer, but the timer runs twice faster each 1 second
The third round makes the timer 3 times faster.
Any one can explain this? or it is a bug of the timer implementation?
If at this point you wanted to do something that will take some time then I'd suggest stopping the timer as you have, calling the function and then broadcast an event to start the timer again once the work has been completed.
Right, start the timer outside the callback could work. What I dont understand is why it does not work inside the callback.
stop and restart a timer itself inside the callback sounds logical for me : )
Anyway, thanks!