Skip to main content
Feb 14, 2014 12:02 PM UTC
Answered

PopUp box on setInterval with timer

Simply put I have a pop-up box that appears on a setInterval timer.

However, I need this pop-up to also run on a timer that if nothing is pressed on the pop-up it goes to another frame.

This is the script I have so far:

popup._visible = false;

var timer=setInterval(timeOut,6000);

function timeOut():Void{

_root.popup._visible =

!_root.popup._visible;

clearInterval(timer);

}

Any help for this to then time again and go to another frame would be appreciated

This topic is closed to new replies. Start a new post to keep the conversation going.
kglad
kgladCorrect answer
Community Expert
Feb 14, 2014 5:59 PM UTC

var timer=setInterval(timeOut,6000);

var gotoTO:Number;

function timeOut():Void{

_root.popup._visible =

!_root.popup._visible;

clearInterval(timer);

clearInterval(gotoTO)

gotoTO=setTimeout(gotoF,3000);

}

function gotoF():Void{

_root.gotoAndStop("presentation_frame1");  // label this frame

}

3 replies

kglad
Community Expert
Community Expert
Feb 14, 2014 3:07 PM UTC

:

//when something is pressed, use:

clearInterval(timer);
timer=setInterval(timeOut,6000);

Translate
Feb 14, 2014 5:06 PM UTC

Thing is I don't want anything pressed at this point, when the pop-up is visible. I am simply looking for it to hold for x amount of seconds and then goto frame 1 (start of the presentation)

Translate
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
Feb 14, 2014 5:59 PM UTC

var timer=setInterval(timeOut,6000);

var gotoTO:Number;

function timeOut():Void{

_root.popup._visible =

!_root.popup._visible;

clearInterval(timer);

clearInterval(gotoTO)

gotoTO=setTimeout(gotoF,3000);

}

function gotoF():Void{

_root.gotoAndStop("presentation_frame1");  // label this frame

}

Translate