Skip to main content
February 13, 2014
Answered

Reset interval timer on button

  • February 13, 2014
  • 1 reply
  • 992 views

I'm building a touch screen presentation for a booth and I need to set a timer that states that if there is no activity it goes back to frame 1.

I need if possible to reset the timer if someone presses any button to start again.

I have a setInterval time set in the first frame:

var timer= setInterval(timeOut,6000);

function timeOut():Void{

gotoAndPlay(1);

clearInterval(timer);

}

A button click is:

on (press) {

    gotoAndPlay(100);

   clearInterval(timer);

}

I placed the clearinterval(timer) in the button to stop the timer but have not been able to reset.

Any help would be appreciated.

This topic has been closed for replies.
Correct answer kglad

use:

clearInterval(timer);

timer=setInterval(timeOut,6000);

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
February 13, 2014

use:

clearInterval(timer);

timer=setInterval(timeOut,6000);

February 13, 2014

Great, thanks for that it works well.

kglad
Community Expert
Community Expert
February 13, 2014

you're welcome.