# clearInterval

**URL:** <https://forum.kirupa.com/t/clearinterval/30165>\
**Category:** Uncategorized\
**Created:** [September 4, 2003, 4:55pm UTC](https://forum.kirupa.com/t/clearinterval/30165 "2003-09-04T16:55:15Z")\
**Posts on this page:** 16\
**Page:** 2

<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 4, 2003, 9:00pm UTC](https://forum.kirupa.com/t/clearinterval/30165/21 "2003-09-04T21:00:51Z")

</div>

OMG!!! It works!! I can’t believe we had to go through all of that!!

Ugh… something so simple!

Oh well… so relieved now… 🙂

Beers for everyone is this thread! Gulp… Gulp… Gulp…

I appreciate it.

---

<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 4, 2003, 9:03pm UTC](https://forum.kirupa.com/t/clearinterval/30165/22 "2003-09-04T21:03:43Z")

</div>

what was it?

heh and I can’t actually drink for 4 more years…

legally :whistle:

---

<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 4, 2003, 9:07pm UTC](https://forum.kirupa.com/t/clearinterval/30165/23 "2003-09-04T21:07:18Z")

</div>

what exactly was the problem?

btw, I see a lot of pathing.clearInterval() when clearInterval is a global function and the pathing is for the interval being cleared

clearInterval(path.path.interval);

you can find some extended setInterval functions here:  
[http://proto.layer51.com/d.aspx?f=857](http://proto.layer51.com/d.aspx?f=857)  
[http://proto.layer51.com/d.aspx?f=877](http://proto.layer51.com/d.aspx?f=877)

and here is a setTimeout:

```auto
_global.setTimeout = function(a,b,c, args){
	// for a basic function call:
	if (typeof a == "function"){
		args = arguments.slice(2);
		var ID, func = function(){
			a.apply(null, args);
			clearInterval(ID);
		}
		ID = setInterval(func, b, args);
		
	// for an object method call:
	}else{
		args = arguments.slice(3);
		var ID, func = function(){
			a**.apply(a, args);
			clearInterval(ID);
		}
		ID = setInterval(func, c, args);
	}
	return ID;
}
_global.clearTimeout = clearInterval;

```

[more on setinterval](http://www.umbc.edu/interactive/flash/tutorials/showpage.php?p=setInterval)

---

<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 4, 2003, 9:07pm UTC](https://forum.kirupa.com/t/clearinterval/30165/24 "2003-09-04T21:07:36Z")

</div>

Just subtracting the “level0” or the “\_root” off the front of the code like this:

```auto
movieLoader.subMovieLoader.clearInterval(stall);

```

I can’t believe it was something so simple.

---

<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 4, 2003, 9:10pm UTC](https://forum.kirupa.com/t/clearinterval/30165/25 "2003-09-04T21:10:15Z")

</div>

well i guess i was right, and I deleted that post because i thought it wouldnt work

---

<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 4, 2003, 9:12pm UTC](https://forum.kirupa.com/t/clearinterval/30165/26 "2003-09-04T21:12:57Z")

</div>

sen…what on earth does that code do?

[edit] got it when i stared long enough…i think[/edit]

---

<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 4, 2003, 9:32pm UTC](https://forum.kirupa.com/t/clearinterval/30165/27 "2003-09-04T21:32:04Z")

</div>

HOLD ON!!!

No guys… that didn’t solve the problem… ugh… lame.

The code:

```auto
movieLoader.subMovieLoader.clearInterval(stall);

```

Doesn’t fix the problem.

---

<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 4, 2003, 9:36pm UTC](https://forum.kirupa.com/t/clearinterval/30165/28 "2003-09-04T21:36:08Z")

</div>

Did you look closely at what Sen posted? He wants you to do  
clearInterval(\<path\>.stall);

Not put the path at the beginning of the call to clearInterval

Liz

---

<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 4, 2003, 9:40pm UTC](https://forum.kirupa.com/t/clearinterval/30165/29 "2003-09-04T21:40:02Z")

</div>

Like this?

```auto
clearInterval(movieLoader.subMovieLoader.stall);

```

Not working…

---

<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 4, 2003, 9:43pm UTC](https://forum.kirupa.com/t/clearinterval/30165/30 "2003-09-04T21:43:22Z")

</div>

REMINDER: Here’s the “setInterval” in the loaded movie:

```auto
function pause(t, v)
{
	stall = setInterval(unPause, v, t);
	t.stop();
}

function unPause(t)
{
	clearInterval(stall);
	t.play();
}

pause(this,3000);

```

This should be a simple route through the paths… why is it not working?

uhhhhh!!!

---

<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 4, 2003, 9:54pm UTC](https://forum.kirupa.com/t/clearinterval/30165/31 "2003-09-04T21:54:30Z")

</div>

What happens if you call your unPause function?

\_root.movieLoader.subMovieLoader.unPause(t);

Liz

---

<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 4, 2003, 9:55pm UTC](https://forum.kirupa.com/t/clearinterval/30165/32 "2003-09-04T21:55:43Z")

</div>

use

t.stall = setInterval(unPause, v, t);

---

<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 4, 2003, 9:59pm UTC](https://forum.kirupa.com/t/clearinterval/30165/33 "2003-09-04T21:59:53Z")

</div>

Sorry LAC… that didn’t work either.

SENOCULAR My setInterval is working fine with everything… I just can’t get my buttons on my \_root to route back to the loaded movies and turn the “setInterval” off.

Problem with the path…

---

<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 4, 2003, 10:01pm UTC](https://forum.kirupa.com/t/clearinterval/30165/34 "2003-09-04T22:01:43Z")

</div>

Do I need to put a “targetPath” somewhere? Would that help?

I mean, what’s the deal. I’m totally unloading the movie with the “setInterval” in it, and it’s still running the function.

This is totally whack… ☹

---

<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 4, 2003, 10:13pm UTC](https://forum.kirupa.com/t/clearinterval/30165/35 "2003-09-04T22:13:37Z")

</div>

your function is a function in root. when you call the function, any variables defined in that function (if not local with var which they arent), are assigned in \_root. So, when you call your pause, stall is being set in \_root. Clearing stall would mean using clearInterval(\_root.stall) … or just stall… or \_level1.stall - whatever - whereever that function is. Putting that stall in the movieclip itself, however, with t.stall, lets you have that interval variable direcltly associated with that movieclip and not the timeline of the function. You would want this 1) so you can specificially clear the interval of any specific movieclip with clearInterval(myMovie.stall) and 2) because stall is defined in that timeline of the function (\_root) calling that function twice would mean over-writing an interval variable that was saved before. In setting a new stall, any previous stall interval is lost thereby only allowing one stall variable at a time - not desired. So instead, set stall in t and clear it from t.

---

<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 4, 2003, 10:21pm UTC](https://forum.kirupa.com/t/clearinterval/30165/36 "2003-09-04T22:21:32Z")

</div>

Is this what you mean:

```auto
//===============================
//PAUSE FUNCTION
//===============================
	function pause(t, v)
	{
		t.stall = setInterval(unPause, v, t);
		t.stop();
	}

	function unPause(t)
	{
		trace("clear & play");
		clearInterval(t.stall);
		t.play();
	}

//===============================
// INITIATE FUNCTION
//===============================
	pause(this,3000);

```

The button on \_root with this code:

```auto
clearInterval(movieLoader.subMovieLoader.stall);

```

Is that what you’re talking about? That’s not working either… ☹

[Previous page](https://forum.kirupa.com/t/clearinterval/30165.md?page=1)
