# Looping a MC in the main timeline

**URL:** <https://forum.kirupa.com/t/looping-a-mc-in-the-main-timeline/20220>\
**Category:** flash\
**Created:** [May 6, 2003, 4:17pm UTC](https://forum.kirupa.com/t/looping-a-mc-in-the-main-timeline/20220 "2003-05-06T16:17:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dexa\_007](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@dexa\_007](https://forum.kirupa.com/u/dexa_007)\
**Post date:** [May 6, 2003, 4:17pm UTC](https://forum.kirupa.com/t/looping-a-mc-in-the-main-timeline/20220/1 "2003-05-06T16:17:23Z")

</div>

I’m slowly climbing the AS stairway to glory … but for now, here’s another elementary inquiry:

How do I force my movie clip animation to LOOP – say oh, 5 times – before the main timeline advances to the next frame? Right now, I’ve got a STOP on the frame, and the clip repeats indefinitely (I’ve got a gotoAndPlay(1) goin’ on in the last frame of the MC’s timeline.)

Input is greatly appreciated!

Jeff

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 6, 2003, 4:27pm UTC](https://forum.kirupa.com/t/looping-a-mc-in-the-main-timeline/20220/2 "2003-05-06T16:27:05Z")

</div>

on your first keyframe put the actions:  
inc=0;

then on the frame where you want to loop at put:  
gotoAndPlay(2);  
inc+=1;  
if(inc==5)gotoAndPlay(“nextAnimation”);

you can replace 2 with whatever frame your first animation starts at and “nextAnimation” with a frame label or the frame number of what you want after your first animation loops!

hope that helps…if not I have an .fla]  
-brian2

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 6, 2003, 4:31pm UTC](https://forum.kirupa.com/t/looping-a-mc-in-the-main-timeline/20220/3 "2003-05-06T16:31:08Z")

</div>

Thanks for the reply, Brian2!

Just to clarify … This code appears on the MAIN timeline, right? It puts the MAIN timeline into this designated loop, and won’t move on until the loop releases the hounds, correct?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 6, 2003, 4:33pm UTC](https://forum.kirupa.com/t/looping-a-mc-in-the-main-timeline/20220/4 "2003-05-06T16:33:26Z")

</div>

yes, that is correct

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 6, 2003, 7:05pm UTC](https://forum.kirupa.com/t/looping-a-mc-in-the-main-timeline/20220/5 "2003-05-06T19:05:08Z")

</div>

☹

Can I get that FLA from ya?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 6, 2003, 10:19pm UTC](https://forum.kirupa.com/t/looping-a-mc-in-the-main-timeline/20220/6 "2003-05-06T22:19:10Z")

</div>

sure. here you go.
