Groups | Blog | Home
all groups > flash actionscript > february 2006 >

flash actionscript : Controlling Looping


Fatmat
2/20/2006 9:24:00 PM
I'm doing a banner ad and it has to loop 3 times.

So what I have is in my main timeline 2 movies: 1st movie loads some text say
text1Mov . At the end of the text1Mov instance I have a go to the root and play
the next frame which contains text2Mov, and so on. What I want to do is have
the main timeline go through the whole movie once and then load from text2Mov
onward 3 more times and then stop looping.

Any help appreciated thankyou.
Fatmat
2/21/2006 2:18:21 PM
blemmo
2/21/2006 2:46:04 PM
I'd do it like this:
in Frame 1: count=0;
to the Frame where text2Mov begins: add the label "mov2"
and in the last Frame:
count++;
if(count < 4) gotoAndPlay("mov2");
else stop();

That should stop the movie after 3 loops.

cheers,
blemmo
Fatmat
2/21/2006 3:15:45 PM
Well I tried that and no go, it may be a little more complicated than I thought.

You can see what I'm trying to do here:
Fatmat
2/21/2006 3:53:12 PM
blemmo
2/21/2006 7:40:32 PM
Well it's a quite complex setup... took me a while to get behind it.
However, you should place the code in the last Frame of logoMov:
_root.count++;
_root.repeat = true;
if(_root.count < 4) _root.gotoAndPlay("start");
else stop();

and in Frame 1 of _root:
if (!repeat) count = 0;

Now it loops 4 times and stops. I think Frame 3 of _root is never reached,
that's why it didn't work that way.

cheers,
blemmo
Fatmat
2/21/2006 8:09:16 PM
AddThis Social Bookmark Button