PDA

View Full Version : [FMX] looping MC xtime



Melissa Anne
December 10th, 2002, 10:33 AM
Hi,

I need the actionscript code to loop my MC 6 times and then stop at the last frame of this MC.
Can anyone help me?
Thanx !

Moved by h88 - Please post in the right forum next time.

Sorcerer
December 10th, 2002, 10:39 AM
Just create a counter variable and on the last frame of your movie put



if (counter < 6){
counter += 1;
gotoAndPlay(1);
}

ahmed
December 10th, 2002, 11:05 AM
add a blank frame in the begining of the movie with this script on it:


this_loop = 0


this script goes on the last frame:


loops = 6 // or the number of times you want the movie to loop.
if (this_loop==6){
stop();
} else {
gotoAndPlay(2)
}
this_loop +=1


there's a variable "this_loop" that adds 1 whenever one loops is completed, and the if statement check whether the value of that value is 6..

Sorcerer
December 10th, 2002, 11:07 AM
ack, i forgot to add a stop(); make sure you do that

ruth007
December 10th, 2002, 11:09 AM
A few questions-

Is that the last frame of the movie clip or the main timeline (and)

I have on the first frame of the movie clip counter = 0

...and since it doesn't work I need a little more input...

Thanks!

Sorcerer
December 10th, 2002, 11:12 AM
it should be on the last frame of your Movie Clip, also you need to start the variable some place where it won't execute that code again, if it's on the first frame and you are looping back to that it will reset the variable to 0 every time. If you don't specify what the variable is at first when it hits the counter it will assume it is 0 and change it to 1 and go from there.

Melissa Anne
December 10th, 2002, 11:43 AM
thank u all ..it works now!

ruth007
December 10th, 2002, 12:42 PM
on actions layer, frame 1 inside my movie clip I have:

counter

on the last frame of an animation layer inside the same mc I have:

if (counter < 4){
counter += 1;
gotoAndPlay("frmStart");
}

(and) it is still not stopping as desired....

Thanks :sigh:

Sorcerer
December 10th, 2002, 02:04 PM
add a stop(); command after your if statement, i forgot to add it in my original post.