# Problem with setInterval - please help?

**URL:** <https://forum.kirupa.com/t/problem-with-setinterval-please-help/61941>\
**Category:** Uncategorized\
**Created:** [August 23, 2004, 3:00pm UTC](https://forum.kirupa.com/t/problem-with-setinterval-please-help/61941 "2004-08-23T15:00:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pseudodigm](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@pseudodigm](https://forum.kirupa.com/u/pseudodigm)\
**Post date:** [August 23, 2004, 3:00pm UTC](https://forum.kirupa.com/t/problem-with-setinterval-please-help/61941/1 "2004-08-23T15:00:45Z")

</div>

This is really strange. I left work friday and this was working fine, I come in this morning and it doesn’t work. I can only figure I did something without realizing it.

I have a movie that I want to play a piece, then wait (because voice will be overlaid) then after a set period of time, it moves on…

I used this:

stop();  
function wait() {  
gotoAndPlay(2);  
trace (“testing”);  
clearInterval(myTimer);  
}  
myTimer = setInterval(wait, 2000);

Which should (?) wait 2 seconds, then go to frame two (and give me the “testing” output) only once, right? Because what it does is waits 2 seconds, goes to frame 2, gives me “testing”…then does it again 2 seconds later…and again…and again…

I thought clearInterval was supposed to stop it? what am I doing wrong?

The fla is here, if you want to look at it (about 3 megs):  
[http://www.pseudodigm.com/files/automated.zip](http://www.pseudodigm.com/files/automated.zip)

Rick

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 23, 2004, 4:02pm UTC](https://forum.kirupa.com/t/problem-with-setinterval-please-help/61941/2 "2004-08-23T16:02:04Z")

</div>

clearInterval will stop it… but each time its being stopped the setInterval is calling the function all over again, only to be stopped again by your clearInterval.
