3 Replies Latest reply on May 25, 2007 12:59 PM by dzash2000

    repeating a timeline

    dzash2000
      Hi, I have a MC with a 20 frame animation. I want its time line to repeat a couple of times but not forever. Besides copying and pasting frames, is there a way to set the number of repeats? and then just have it stop on the last frame? Isn't there a setting somewhere?
      Appreciate the help.
      D2
        • 1. Re: repeating a timeline
          kglad Adobe Community Professional & MVP
          there's no setting, but you can use actionscript to control your timeline. if you're using as 2, on the last frame of your mc you can use:

          • 2. Re: repeating a timeline
            cpgenius Level 1
            quote:

            Originally posted by: dzash2000
            Hi, I have a MC with a 20 frame animation. I want its time line to repeat a couple of times but not forever. Besides copying and pasting frames, is there a way to set the number of repeats? and then just have it stop on the last frame? Isn't there a setting somewhere?
            Appreciate the help.
            D2


            It can be tricky depending upon what the animation is that you want to repeat.

            Try this. In the first frame, you put:

            quote:

            count=0;


            then in the last frame of the animation:

            quote:


            //takes the value of the count variable and adds 1 to it each time
            count += 1;
            //as long as the count is less than or equal to 5 go back to the 10th frame and play it
            if (count<=5) {
            gotoAndPlay(10);
            } else {

            //otherwise stop it
            stop();
            }

            • 3. Re: repeating a timeline
              dzash2000 Level 1
              cpgenius - Thanks. At first I didn't use your solution exactly as written. I thought that you put (10) there arbitrarily and I didn't want to replay from (10) anyway - so I changed it to (1) and the code didn't work. After I put it back the way you wrote it, it sure did work perfectly. So the "trick" is not to go back to frame 1 because that starts the count over at "0" again. I pick things up eventually. ;-)
              Thanks again.
              d2