Copy link to clipboard
Copied
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.
use:
clearInterval(timer);
timer=setInterval(timeOut,6000);
Copy link to clipboard
Copied
use:
clearInterval(timer);
timer=setInterval(timeOut,6000);
Copy link to clipboard
Copied
Great, thanks for that it works well.
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
I have another problem that has cropped up with the setInterval timer:
I now have a popup box as a MovieClip that is invoked after a set time. The pop-up box has a YES and NO button
YES button works simply by going back to frame 1 and resets as before.
The NO button should simply close the pop-up (an invisible item) and stay on what ever frame and reset as below.
Unfortunately, it ignores the clearInterval settings, script as follows:
on (release) {
_root.endpres._visible =
!_root.endpres._visible;
clearInterval(timer);
timer=setInterval(timeOut,6000);
}
Any help would be appreciated again.
Copy link to clipboard
Copied
I solved this simply with:
on (release) {
_root.endpres._visible =
!_root.endpres._visible;
}
the setInterval time then kicks in again on another button click.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now