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 !
[COLOR=silver][SIZE=1]Moved by h88 - Please post in the right forum next time.[/SIZE][/COLOR]
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 !
[COLOR=silver][SIZE=1]Moved by h88 - Please post in the right forum next time.[/SIZE][/COLOR]
Just create a counter variable and on the last frame of your movie put
if (counter < 6){
counter += 1;
gotoAndPlay(1);
}
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…
ack, i forgot to add a stop(); make sure you do that
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!
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.
thank u all …it works now!
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:
add a stop(); command after your if statement, i forgot to add it in my original post.
:: Copyright KIRUPA 2024 //--