In your main “action” timeline, frame 1 put the following code:
////////////////// Pause Function /////////////////////
this.createEmptyMovieClip(“timer”,50);
timer.onEnterFrame = function()
{
if (this.startTime>0)
{
var diff = getTimer()-this.startTime;
if (diff>this.timerLength)
{
this.target.play();
this.startTime = 0;
}
}
};
function pauseFor(theTime)
{
stop();
timer.timerLength = theTime;
timer.startTime = getTimer();
timer.target = this;
}
///////////////////////////////////////////////////
Then on the frame you want to pause, add: pauseFor(3000) //this would pause for 3 seconds.
What exactly do I need to put on the pause frame, and can I use this multiple times in the same timeline?
Try copying and pasting this on Frame 1(It worked without syntax errors for me, I am supposing the smileys got in your way, so I am posting it again without the smileys)…
////////////////// Pause Function /////////////////////
this.createEmptyMovieClip("timer", 50);
timer.onEnterFrame = function() {
if (this.startTime>0) {
var diff = getTimer()-this.startTime;
if (diff>this.timerLength) {
this.target.play();
this.startTime = 0;
}
}
};
function pauseFor(theTime) {
stop();
timer.timerLength = theTime;
timer.startTime = getTimer();
timer.target = this;
}
///////////////////////////////////////////////////
I’d like to apply a script on some VCR buttons to stop the movie completely at any time. I need that button to clear out the ‘pause’… so how would I clear the interval out. I’ve tried numbeous methods, but nothing is working.
Ok, I just realized that the pause script uses getTimer to setInterval, so clearing the interval won’t help unless you have another script that uses it.
Sorry to bug you again man, but this thing is driving me crazy. Here’s my code:
on(press) {
var diff = getTimer()-this.startTime;
_level1.stop();
}
It’s still the same problem. I can get it to stop when it’s in a tween, but won’t stop when it’s on a frame with the ‘pause’ function attached.
I’m also wondering… if you clear out the ‘timer’, how will it be re-instated? I also have a play button… how am I going to let the function know to getTimer again?
Well if the movie is paused, why do you want to stop it?
Don’t need to reinstate getTimer(), it is always adding up, that is why you must subtract it from itself, because it keeps going higher and higher the longer your movie is played.
I am not sure how to fix the problem, you are tackling something I have never tackled, and from what it sounds like, it is probably out of my league :-\