3 Replies Latest reply on Nov 16, 2006 11:57 PM by Cactus Woman

    Can I delay the start of movie clip?

    Cactus Woman
      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!
        • 1. Re: Can I delay the start of movie clip?
          j-eggs
          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.
          • 2. Re: Can I delay the start of movie clip?
            clbeech Level 3
            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.
            • 3. Re: Can I delay the start of movie clip?
              Cactus Woman Level 1
              Brilliant, thank you, I'll try both of those out!!