# How to repeat 5 times?

**URL:** <https://forum.kirupa.com/t/how-to-repeat-5-times/3634>\
**Category:** programming\
**Created:** [January 15, 2002, 9:49pm UTC](https://forum.kirupa.com/t/how-to-repeat-5-times/3634 "2002-01-15T21:49:29Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [January 15, 2002, 9:49pm UTC](https://forum.kirupa.com/t/how-to-repeat-5-times/3634/1 "2002-01-15T21:49:29Z")

</div>

How do I get an animation to repeat only 5 times (without puting the animation in the time line 5 times) then go to somewhere else, say frame 50.

Any help would be great?

Matt

---

<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:** [January 15, 2002, 9:55pm UTC](https://forum.kirupa.com/t/how-to-repeat-5-times/3634/2 "2002-01-15T21:55:06Z")

</div>

Is it a clip or an animation in the main timeline ?

If it’s a clip, it’s easier :  
in the main timeline, in the frame that contains the clip, add the script to the frame :  
var looping =0 ;  
in the clip timeline, on the last frame, write :  
stop() ;  
\_root.looping ++ ;

if (looping == 5) {  
\_root.gotoAndPlay (50) ;  
}

else {  
gotoAndPlay (1) ;  
}  
If you use the main timeline, it’s basically the same except you can’t initialize looping like that, of you’ll have to gotoAndplay (2) ;

Should work.

pom

---

<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:** [January 16, 2002, 12:35am UTC](https://forum.kirupa.com/t/how-to-repeat-5-times/3634/3 "2002-01-16T00:35:38Z")

</div>

Thanks I will give it a go!

Matt
