# Pause function

**URL:** <https://forum.kirupa.com/t/pause-function/27185>\
**Category:** Uncategorized\
**Created:** [July 30, 2003, 9:43pm UTC](https://forum.kirupa.com/t/pause-function/27185 "2003-07-30T21:43:38Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![earph](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/earph/32/79_2.png) [@earph](https://forum.kirupa.com/u/earph)\
**Post date:** [July 30, 2003, 9:43pm UTC](https://forum.kirupa.com/t/pause-function/27185/1 "2003-07-30T21:43:38Z")

</div>

I’ve got this pause function, but I’m unable to clearInterval, I’ve tried everything. I’d like to know if someone had a pause function that was a little simpilar than the one below.

//SET PAUSE FUNCTION  
//=======================================  
function pause(t, v)  
{  
t.interval = setInterval(unPause, v, t);  
t.stop();  
}

```
function unPause(t)
{
	clearInterval(t.interval);
	t.play();
}

```

// PAUSE THIS MOVIE  
//=================================  
pause(this, 3000)

---

<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:** [July 30, 2003, 9:48pm UTC](https://forum.kirupa.com/t/pause-function/27185/2 "2003-07-30T21:48:43Z")

</div>

are you just trying to make a movie clip stop when you press a button, then unstop when you press it again? or do you want it to be on a timer?

---

<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:** [July 30, 2003, 9:50pm UTC](https://forum.kirupa.com/t/pause-function/27185/3 "2003-07-30T21:50:28Z")

</div>

[![](http://www.kirupaforum.com/images/search_top.gif)](http://www.kirupaforum.com/forums/search.php?s=) :sigh:

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=30002](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=30002)

---

<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:** [July 30, 2003, 9:52pm UTC](https://forum.kirupa.com/t/pause-function/27185/4 "2003-07-30T21:52:23Z")

</div>

I’d like for it to pause when it hits a certain frame, then continue after it’s ran through the “pause”.

The above code works fine for one pass through.

Problem is, if I click buttons to jump to a new section, the interval won’t clear. I’ve tried putting the clearInterval() everywhere… on the buttons, in the same frames, other frames, beginning of movies, etc. Nothing works.

I just figured I’d try another pause method and see if I could get it to work.

Anyways… just “pause on the frame”.

---

<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:** [July 30, 2003, 10:00pm UTC](https://forum.kirupa.com/t/pause-function/27185/5 "2003-07-30T22:00:24Z")

</div>

I found this one:

========================================

this.stop();  
pause = function () {  
play();  
clearInterval(stall);  
}  
stall = setInterval(pause, 10000);

=========================================

Would anyone mind explaining to me how it works?

Thanks!!

---

<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:** [July 30, 2003, 10:07pm UTC](https://forum.kirupa.com/t/pause-function/27185/6 "2003-07-30T22:07:18Z")

</div>

On whatever frame you place that script on, it will pause it for 10 seconds.

10000 = 10 seconds

---

<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:** [July 30, 2003, 10:18pm UTC](https://forum.kirupa.com/t/pause-function/27185/7 "2003-07-30T22:18:21Z")

</div>

I think I understand…

Thanks for all the help… I think I got this figured out!

---

<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:** [July 31, 2003, 8:25pm UTC](https://forum.kirupa.com/t/pause-function/27185/8 "2003-07-31T20:25:58Z")

</div>

OK OK… everything is working good with the above pause function, but I can’t get it to cancel. I’m putting

clearInterval(name);

in the frame right after the pause, but it’s not canceling the pause. Do I need to add something to it?

Lost…

---

<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:** [July 31, 2003, 8:32pm UTC](https://forum.kirupa.com/t/pause-function/27185/9 "2003-07-31T20:32:51Z")

</div>

Isn’t it suppose to be:

```auto
clearInterval(stall);

```

Since that’s what it was called in the pause script above?

---

<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:** [July 31, 2003, 8:32pm UTC](https://forum.kirupa.com/t/pause-function/27185/10 "2003-07-31T20:32:57Z")

</div>

Nevemind guys… I was smoking crack and putting the wrong name in the

clearInterval(name);

---

<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:** [July 31, 2003, 8:35pm UTC](https://forum.kirupa.com/t/pause-function/27185/11 "2003-07-31T20:35:49Z")

</div>

Right… I was putting:

clearInterval (stall);

but for some reason it wasent’ clearing, so I put,

clearInterval (pause);

which refers to the function… and it worked somehow… oh well, as long as it works.

---

<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:** [July 31, 2003, 8:41pm UTC](https://forum.kirupa.com/t/pause-function/27185/12 "2003-07-31T20:41:15Z")

</div>

Sorry to screw this thread up… but, actually neither one of those clearInterval() are working.

They actually don’t stop working until my movie is loaded into a blank MC on the \_root.

Would that have anything to do with it?
