# setInterval

**URL:** <https://forum.kirupa.com/t/setinterval/63186>\
**Category:** Uncategorized\
**Created:** [September 3, 2004, 5:01pm UTC](https://forum.kirupa.com/t/setinterval/63186 "2004-09-03T17:01:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cki](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@cki](https://forum.kirupa.com/u/cki)\
**Post date:** [September 3, 2004, 5:01pm UTC](https://forum.kirupa.com/t/setinterval/63186/1 "2004-09-03T17:01:23Z")

</div>

Hi,

I’m attempting to advance a movie by time not by frame rate so, on frame 34 I have

```auto
function playNext() {
	gotoAndPlay("scene1");
	clearInterval(timerInterval);
}
timerInterval = setInterval(playNext, 5000);

```

with a scene1 label at frame 45, but the movie does not stop at 34, it continues to frame 45 plays to 55, where their is a

```auto
stop()

```

action. At frame 55 it loops back to 45, playing once again to 55 then stops.

What Am I missing?

---

<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:** [September 3, 2004, 6:47pm UTC](https://forum.kirupa.com/t/setinterval/63186/2 "2004-09-03T18:47:33Z")

</div>

I’m having setInterval issues as well. Just trying to pause the movie…but after a while it starts to speed up and then is not functional at all.

```auto
function wait() {
	stop();
	var myInterval = setInterval(function () {
		play();
		clearInterval(myInterval);
	}, 5*1000);
	// stop for 5 seconds 
}

```

on the frame I want to pause

```auto

wait();
stop();

```

---

<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:** [September 3, 2004, 6:52pm UTC](https://forum.kirupa.com/t/setinterval/63186/3 "2004-09-03T18:52:10Z")

</div>

> [@mikeh](#):
>
> I’m having setInterval issues as well. Just trying to pause the movie…but after a while it starts to speed up and then is not functional at all.
> 
> ```auto
> function wait() {
> stop();
> var myInterval = setInterval(function () {
> play();
> clearInterval(myInterval);
> }, 5*1000);
> // stop for 5 seconds 
> }
> 
> ```
> 
> on the frame I want to pause
> 
> ```auto
> 
> wait();
> stop();
> 
> ```

Hi,

I solved my issued by putting a stop action on the frame after the set interval function. All is well, but is this this the most efficient method?

---

<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:** [September 3, 2004, 6:52pm UTC](https://forum.kirupa.com/t/setinterval/63186/4 "2004-09-03T18:52:12Z")

</div>

> [@cki](#):
>
> Hi,
> 
> I’m attempting to advance a movie by time not by frame rate so, on frame 34 I have
> 
> ```auto
> function playNext() {
> gotoAndPlay("scene1");
> clearInterval(timerInterval);
> }
> timerInterval = setInterval(playNext, 5000);
> 
> ```
> 
> with a scene1 label at frame 45, but the movie does not stop at 34, it continues to frame 45 plays to 55, where their is a
> 
> ```auto
> stop()
> 
> ```
> 
> action. At frame 55 it loops back to 45, playing once again to 55 then stops.
> 
> What Am I missing?

Have you put a stop() in frame 34 as well?
