Help with setInterval and pausing animation?

Howdy all,

I am using this script from

//In your main “action” timeline, frame 1 put the following code:
////////////////// Pause Function /////////////////////
timer.onEnterFrame = function()
if (this.startTime>0)
var diff = getTimer()-this.startTime;
if (diff>this.timerLength)
this.startTime = 0;
function pauseFor(theTime)
timer.timerLength = theTime;
timer.startTime = getTimer(); = this;
//Then on the frame you want to pause, add: pauseFor(3000)
//this would pause for 3 seconds.

I have the function written on my main time line but I want to call it from the middle of an animation on a movie clip. I’m not sure how to reference the function on the maintimeline. I’ve tried referencing the created MC “timer”, I’ve tried referencing _root and other things but nothing seems to work. :h:

Basically I have a simple motion tween. I want it to get to a certain point then stop then continue. I have two tweens on one layer in my animated MC. Any suggestions?

oh yeah, and I’d like to be able to call the same function from other MCs doing similar things. How can I reference the function?

using setInterval:
//on the pausing frame, all you have to do is put,

interval = setInterval( function () {
}, 3000);

//to pause for 3000 milliseconds (3 secs);


Thanks Clownstaples! I’ll try it out!