Reputation: 129
stop ()
Is there a function what will play a timeline two times and after it stops ? from frame 1 to 15 I want it to play two times and stop after. I don't want to duplicate timeline.
Upvotes: 0
Views: 2376
Reputation: 4214
No code needed:
and it will loop 2 times :-)
Upvotes: 1
Reputation: 35
Put this code into the last frame. // we did not assign any value to the variable loopCount and use condition for assigning value in our variable loopCount. and second time first condition will not run and loopCount value will not change. then we are increasing loopCount value by 1 in every loop of animation. then just write condition to stop the movie by checking loopCount value.
//Put this code into the last frame or where you want to stop your movie after playing 2 times.
if(!loopCount){var loopCount:Number = 0;}
loopCount++;
if(loopCount >= 2){stop();}
Upvotes: 0
Reputation: 6715
var loop:int = 2;
var counter:int = 0;
Put this to first frame and leave it empty, start animation from second frame.
if(counter == loop){
stop();
}
And copy this block to where you want animation to stop.
counter++;
gotoAndPlay(2);
Copy this to last frame
Upvotes: 0
Reputation: 1310
var i = 0; // put this on a blank first frame
// put this on the last frame
i++;
if(i==2){
stop();
}else{
gotoAndPlay(1); // that might be 0 not sure a bit rusty on flash
}
I'm not promising this will work because I haven't messed with flash in a few months but you can give it a try.
Upvotes: 0