PDA

View Full Version : play entire movie 2 times then stop



linque
September 5th, 2002, 01:31 AM
last week I learned to play a movieclip a specified number of times then stop.

Now, I need to stop an entire .fla (or, it may become a scene, but for now it's the only content) after it loops TWO times only.

The .fla has one frame containing graphics and text on separate layers and 4 movieclips on different layers. The movieclips have no actionscript in them right now. They are essentially tweens over staggered times.

In fact, right now there's no actionscript anywhere in this particular .fla.

How can I play it two times then stop. Also, I need to be able to accomodate further stuff after this.. that is, the movie is not yet been completed..it was just a start, but it's only this part that *is* completed I need to loop twice.

Please could you let me where the code would go too?

thank you

linda

Bezzer
September 5th, 2002, 01:37 AM
set a variable in the first frame
myVar +=1;

Then do an if at the end of the animation

if(myVar = 2){
stop();
}else{
gotoAndPlay(1);
}

Ok that should work :)

linque
September 5th, 2002, 02:04 AM
I added an actionscript layer, put in your code for the first frame, added a new keyframe in frame2 and put the rest of the code there. I also added blank frames to each of the other layers so all is 2 frames long. it's not working yet.. I used your script verbatim. Is there something I was to attach the variable to? somewhere in the property inspector?

sorry..newbie here...

lostinbeta
September 5th, 2002, 02:15 AM
instead of gotoAndPlay try gotoAndStop(frame#)

This assures it will STOP at that frame, where, even if a stop() action is applied to the frame gotoAndPlay will surpass it and still play the clip.

Bezzer
September 5th, 2002, 02:15 AM
verbatim? :)

lostinbeta
September 5th, 2002, 02:16 AM
I was wondering the same thing.

Bezzer
September 5th, 2002, 02:17 AM
yeah...ok

linque
September 5th, 2002, 03:05 AM
I used code to count up within the tweened movieclips.
It wouldn't work on the main timeline, although I suppose I've erred somewhere. thanks anyway.

p.s. verbatim.. yup..

check it out