How to loop a flash banner 3 times then stop?

  • pup
  • Born
  • Born
  • pup
  • Posts: 1

Post 3+ Months Ago

I am new in flash..I need make a flash banner loops 3 times then stop.

How to do it? Please help..thank you very much..
  • contstrictor
  • Novice
  • Novice
  • contstrictor
  • Posts: 26

Post 3+ Months Ago

you can use an array for it
so that anytime the movie ends (ie in the last frame) you add a value to the array. and evaluate the lenght of it. An easier way before the movie starts define a variable explicitly as Number and the add to it after the movie ends and is about to start again and evaluate it each time before you add.
Sample code:
Code: [ Select ]
var timesPlayed:Number = 0;


then on the las frame of your movie clip this goes:
Code: [ Select ]
if(timesPlayed < 3){
timesPlayed ++
}
else{
MovieClip.stop();
}
  1. if(timesPlayed < 3){
  2. timesPlayed ++
  3. }
  4. else{
  5. MovieClip.stop();
  6. }

see how that goes... :?
  • yuriythebest
  • Banned
  • Banned
  • User avatar
  • Posts: 143
  • Loc: Ukraine

Post 3+ Months Ago

constrictors suggestion is correct, yet there is a simple way. Add a layer for the entire length of your movie with the code

thetimes=0;

At the end of your movie add a keyframe with the code:

_root.thetimes+=1;
gotoAndPlay(1);

At that same keyframe create a movie clip (make it inconspicuous) with the code:

onClipEvent(enterFrame){
if(_root.thetimes>=3){
_root.stop();
}
}

hope that helped.
  • UNFLUX
  • Genius
  • Genius
  • User avatar
  • Posts: 6375
  • Loc: twitter.com/unflux

Post 3+ Months Ago

please use the code and php tags when posting! that's what they're there for. ;)
  • contstrictor
  • Novice
  • Novice
  • contstrictor
  • Posts: 26

Post 3+ Months Ago

yuriythebest;
Yeah i think that's an easier suggestion. I usually try to detach myself from timeline based scripting. But yeah that should be easier.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 6 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.