PDA

View Full Version : goToAndPlay question


zoin
09-08-2009, 06:41 PM
Hi,

First, I must specify that i'm not a developper. And, as a graphic designer, I'm not an expert at coding in AS.

I'm now working on a little animation that I would like to be repeated three times before it stops. I guess to way to realise it is to use a little loop that uses the gotoAndStop function with flags and everything, but I dont know how to write it in AS3.

Could someone give me a hand on that?

Thanks!

bmyers
09-08-2009, 07:46 PM
You could do this with a lot of different code.. But if you are doing timeline programming... try this..

frame 1:
var myCounter = 0;
var myRepeats = 3;
stop();
// this is a blank queue frame, your animation won't "start" till you tell it to.


frame 2: //start your animation

frame 3-10: //animation is playing do nothing.

frame 11:
myCounter = myCounter + 1;
if(myCounter == myRepeats) {
stop();
}
else {
gotoAndPlay(2);
}

See if that works for ya.

zoin
09-09-2009, 01:00 PM
Works magnificently. That's kind of a begining in AS3!

Thanks a lot man!