Skip to main content
Participant
November 19, 2015
Question

Loop banner 3 times and stop short of the end frame

  • November 19, 2015
  • 1 reply
  • 427 views

I'm making animated banners that loop 3 times from start to finish, the banner's contents alpha out on the ending frame, but on the third loop I would like the elements to stay visible and make the banner stop moving. How may I use Actionscript to accomplish this?

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
November 19, 2015

How do you control the alpha, via a timeline tween or a coded tween?

In any case you will need to start with having a loop counter so that you can tell when you have reached the desired end point 3 times.  for that you could have something like the following in frame 1...

var count:Number;

if(isNaN(count)){
    count = 0;
}

that will set the initial value of the count variable to zero but also keep the variable from resetting to 0 every time you return to that frame.  Then in the frame where you desired to stop...

count += 1;

if(count == 3){
    stop();
}

rdale1961Author
Participant
November 20, 2015

I control the alpha via a timeline tween.

Ned Murphy
Legend
November 20, 2015

Then either stop the third loop at the start of the tween before it fades, or if you want it to fade before stopping and then re-appear, place it at the end of the timeline and include a command to set the alpha back to 1 in the conditional.