# HELP! with wait Function setInterval

**URL:** https://forum.kirupa.com/t/help-with-wait-function-setinterval/246400
**Category:** flash
**Created:** [December 10, 2007, 9:13pm UTC](https://forum.kirupa.com/t/help-with-wait-function-setinterval/246400 "2007-12-10T21:13:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![NovaGiant](https://avatars.discourse-cdn.com/v4/letter/n/d07c76/32.png) [@NovaGiant](https://forum.kirupa.com/u/NovaGiant)
#### Post date: [December 10, 2007, 9:13pm UTC](https://forum.kirupa.com/t/help-with-wait-function-setinterval/246400/1 "2007-12-10T21:13:35Z")

</div>

FYI: I am really, really new to action script.

I have a movie clip symbol that is place on my main time line. I want the movie clip to display frames for (x) seconds then go to the next frame. I have a chunk of code that works by itself but when placed into my flash site it is causing some strange problems. Such as navigating to a label (page) prior to the movie clip that has the wait function code, freezes the flash. I am wondering if I need \_root or a this in there somewhere.

The reason I want to do this is so I don’t have to add a bunch of frames to get the pause time I need.

Is there a way to use the code below and not have it cause problems with the rest of my time line?

Here is the wait function code

stop();  
i = 1;  
function Wait() {  
i++;  
if (i == 7) {  
gotoAndPlay(1);  
} else {  
nextFrame();  
}  
// or whatever script you would like…  
// clearInterval(WaitInt); // to use the interval only once  
}  
WaitInt = setInterval(Wait, 5000);  
// change to 5000 for 5 sec…

Here is a link where I downloaded the sample code

> **[Example for wait function (Set Interval)..](https://www.kirupa.com/forum/showthread.php?t=90221)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

Thanks for any help. 🙂
