Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Reset interval timer on button

Guest
Feb 13, 2014 Feb 13, 2014

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.

TOPICS
ActionScript
892
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 13, 2014 Feb 13, 2014

use:

clearInterval(timer);

timer=setInterval(timeOut,6000);

Translate
Community Expert ,
Feb 13, 2014 Feb 13, 2014

use:

clearInterval(timer);

timer=setInterval(timeOut,6000);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 13, 2014 Feb 13, 2014

Great, thanks for that it works well.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2014 Feb 13, 2014

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 14, 2014 Feb 14, 2014

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 14, 2014 Feb 14, 2014
LATEST

I solved this simply with:

on (release) {

    _root.endpres._visible =

    !_root.endpres._visible;

}

the setInterval time then kicks in again on another button click.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines