# 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:** 20\
**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:** [September 4, 2003, 4:55pm UTC](https://forum.kirupa.com/t/clearinterval/30165/1 "2003-09-04T16:55:15Z")

</div>

How exactly would I clear this interval with my button?

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

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

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

```

Would I clear the “t.interval” or do I clear the function “(pause)”?

---

<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, 5:08pm UTC](https://forum.kirupa.com/t/clearinterval/30165/2 "2003-09-04T17:08:23Z")

</div>

i don’t know if you can assign it the name t.interval…thats like creating a variable called my.Sound or something, probably isnt very good. Try the following:

[AS]  
//===============================  
//PAUSE FUNCTION  
//===============================  
function pause(t, v)  
{  
tInterval = setInterval(unPause, v, t);  
t.stop();  
}

function unPause(t)  
{  
trace(“clear & play”);  
clearInterval(tInterval);  
t.play();  
}

//===============================  
// INITIATE FUNCTION  
//===============================  
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:** [September 4, 2003, 6:01pm UTC](https://forum.kirupa.com/t/clearinterval/30165/3 "2003-09-04T18:01:03Z")

</div>

I see… thanks for the tip.

But, the question is… If I want to clear this interval… how would I do it. Would it be:

```auto
clearInterval(tinterval);

```

or would it be

```auto
clearInterval(pause);

```

or would it be something entirely different.

Thanks for the help!

---

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

</div>

tInterval

---

<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, 6:12pm UTC](https://forum.kirupa.com/t/clearinterval/30165/5 "2003-09-04T18:12:22Z")

</div>

So… will that globally clear that interval? Cause that is basically what I need to do. I need to clear all the intervals when I hit my “back” button.

---

<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, 6:15pm UTC](https://forum.kirupa.com/t/clearinterval/30165/6 "2003-09-04T18:15:29Z")

</div>

you will need to clear each one by itself then. I dunno if you can create a global Interval and then clear that, ask someone like lost, kode, or sen.

---

<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, 6:18pm UTC](https://forum.kirupa.com/t/clearinterval/30165/7 "2003-09-04T18:18:34Z")

</div>

Well… nevermind the \_global clear… What if I want to clear the interval from some other loaded movie, would I do it like this:

```auto
 _root.somemovie.anothermovie.clearInterval(pause);

```

I just need to shut the function totally off. I’ve even tried unloading the movie, but the output window shows that it’s still running the interval function.

How can I turn it off?

---

<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, 6:38pm UTC](https://forum.kirupa.com/t/clearinterval/30165/8 "2003-09-04T18:38:52Z")

</div>

you dont clear the function name, you clear whatever you assigned the value of setInterval to. So it would be  
[AS]  
\_root.someMovie.anotherMovie.clearInterval(tInterval);  
[/AS]

---

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

</div>

Sorry, but it’s not working for me. I’ve got a button on my \_root that’s calling down through 2 sub-movies, but it’s not picking it up.

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

```

Shouldn’t it talk to what ever movies are loaded into the “movieLoader” and “subMovieLoader”?

---

<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, 7:57pm UTC](https://forum.kirupa.com/t/clearinterval/30165/10 "2003-09-04T19:57:53Z")

</div>

try tracing to make sure your path is correct

---

<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, 8:05pm UTC](https://forum.kirupa.com/t/clearinterval/30165/11 "2003-09-04T20:05:54Z")

</div>

Not exactly sure how to do that with the clearInterval. I have a trace set up in my setInterval function, and it displays everytime the function runs. Is that what you mean?

Otherwise, I’m not sure how to run the trace for the “clearInterval”.

Would it be something like this?

```auto
if(_root.movieLoader.subMovieLoader.clearInterval(stall);{
trace(it got cleared);}

```

---

<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, 8:09pm UTC](https://forum.kirupa.com/t/clearinterval/30165/12 "2003-09-04T20:09:00Z")

</div>

yeah (but you are missing a parenthesis there 😉 ) I dunno if that will work because I don’t know whether clearInterval returns a boolean value. You might just want to check the path.

[AS]  
trace(\_root.movieLoader.subMovieLoader);  
[/AS]

---

<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, 8:17pm UTC](https://forum.kirupa.com/t/clearinterval/30165/13 "2003-09-04T20:17:21Z")

</div>

Wow… I learned something new. I never knew you good check paths like that.

Well… the output window is showing “undefined”, so I guess it’s not picking up the path… which sucks.

I mean… that’s a direct path… it should work, what else can we do?

If there is a movie called “orange” that is loaded into a blank mc called “movieLoader”… You should just be able to talk to the “orange” movie by calling “movieLoader”, right?

---

<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, 8:21pm UTC](https://forum.kirupa.com/t/clearinterval/30165/14 "2003-09-04T20:21:56Z")

</div>

yes. if you load a movie clip into another, it takes on the attributes of the first and can be referenced using the instance name of the first.

---

<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, 8:24pm UTC](https://forum.kirupa.com/t/clearinterval/30165/15 "2003-09-04T20:24:26Z")

</div>

This totally sucks then… cause the path should be right. I can’t think of anything else right now. I think I need to step away and go get a drink real fast… I’ll be back to stare at this thing some more.

I appreciate all the help…

---

<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, 8:29pm UTC](https://forum.kirupa.com/t/clearinterval/30165/16 "2003-09-04T20:29:17Z")

</div>

welcome

---

<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, 8:41pm UTC](https://forum.kirupa.com/t/clearinterval/30165/17 "2003-09-04T20:41:21Z")

</div>

Hi,

try trace(targetPath(\_root.movieLoader.subMovieLoader));

that should give you the same path that you put in if it’s correct. If not then it will return undefined I think.

The other thing to try is in the onClipEvent(load) of the subMovieLoader put… trace(targetPath(this)); and that will give you the path to that movie clip.

Hope this helps.

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, 8:48pm UTC](https://forum.kirupa.com/t/clearinterval/30165/18 "2003-09-04T20:48:17Z")

</div>

or you can just

trace(this);

same thing.

---

<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, 8:51pm UTC](https://forum.kirupa.com/t/clearinterval/30165/19 "2003-09-04T20:51:23Z")

</div>

Wow… that’s another kewl tip also… thanks!

But… still no dice. Not working.k

The trace returned “\_level0.movieLoader.subMovieLoader”, so I inserted on my \_root button like this:

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

```

But… it’s still not clearing it out. This is lame… ☹

---

<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, 8:59pm UTC](https://forum.kirupa.com/t/clearinterval/30165/20 "2003-09-04T20:59:40Z")

</div>

dunno man. sorry. is your interval named stall? and did you set it right? not sure

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