Skip to main content
November 16, 2006
Question

Can I delay the start of movie clip?

  • November 16, 2006
  • 3 replies
  • 359 views
Without inserting loads of blank frames, can I delay the start of my movie clip? Also, can I get it to loop a specified number of times? Thanks!
This topic has been closed for replies.

3 replies

November 17, 2006
Brilliant, thank you, I'll try both of those out!!
clbeech
Inspiring
November 16, 2006
Or perhaps use onEnterFrame and increment a variable. Start the MovieClip (ie. play() ) at a particular number of loops dependant on the frame rate of the SWF, at 12 fps say for instance, in the first frame:

stop();
var Time:Number = 0;

onEnterFrame = function() {
If(Time == 24) {
play();
}else if(Time == 120) {
stop();
onEnterFrame = null;
}
Time++;
}

within the "elseIf" part of the code, count up the number of frames that would run during as many iterations of the loop as you want, and add in the initial delay number.

Set Interval will work for the delay, but won't help with the looping here. You could use it to start the MC then use a simpler incremeted variable and IF statement within the MC running.
Participant
November 16, 2006
Use a setInterval
eg.

delayMovie = setInterval(this, "startMovie", 500); //500 millisecond delay

function startMovie () {
clearInterval(delayMovie);
movie.play();
}

the syntax may be wrong, but you get the idea.