clearInterval

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

Ugh… something so simple!

Oh well… so relieved now… :slight_smile:

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

I appreciate it.

what was it?

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

legally :whistle:

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=877

and here is a setTimeout:

_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

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

movieLoader.subMovieLoader.clearInterval(stall);

I can’t believe it was something so simple.

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

sen…what on earth does that code do?

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

HOLD ON!!!

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

The code:

movieLoader.subMovieLoader.clearInterval(stall);

Doesn’t fix the problem.

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

Like this?

clearInterval(movieLoader.subMovieLoader.stall);

Not working…

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

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!!!

What happens if you call your unPause function?

_root.movieLoader.subMovieLoader.unPause(t);

Liz

use

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

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…

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… :frowning:

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.

Is this what you mean:

//===============================
//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:

clearInterval(movieLoader.subMovieLoader.stall);

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