# Making the animation loop

**URL:** <https://forum.kirupa.com/t/making-the-animation-loop/79362>\
**Category:** programming\
**Created:** [February 13, 2005, 2:02pm UTC](https://forum.kirupa.com/t/making-the-animation-loop/79362 "2005-02-13T14:02:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_Pancake](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Mr\_Pancake](https://forum.kirupa.com/u/Mr_Pancake)\
**Post date:** [February 13, 2005, 2:02pm UTC](https://forum.kirupa.com/t/making-the-animation-loop/79362/1 "2005-02-13T14:02:32Z")

</div>

Sorry for the many treads if posted, but im a hard worker ;).

ok now i need to know is:

I have a moviclip that contains a guy that is walking, i made a stop(); action

In the first frame. on the movieclip actions i wrote:

[color=red]onClipEvent (load) {  
speed = 10;  
}  
onClipEvent (enterFrame) {  
if (Key.isDown(Key.RIGHT)) {  
\_rotation += 20;  
}  
if (Key.isDown(Key.LEFT)) {  
\_rotation -= 20;  
}  
if (Key.isDown(Key.UP)) {  
\_y -= speed_Math.cos(\_rotation_(Math.PI/180));  
\_x += speed_Math.sin(\_rotation_(Math.PI/180));  
}  
if (Key.isDown(Key.DOWN)) {  
\_y += speed_Math.cos(\_rotation_(Math.PI/180));  
\_x -= speed_Math.sin(\_rotation_(Math.PI/180));  
}  
}[/color]  
[color=#ff0000][/color]  
if i put a gotoAndPlay() action like this:  
[color=#ff0000]if (Key.isDown(Key.UP)) {  
\_y -= speed_Math.cos(\_rotation_(Math.PI/180));  
\_x += speed_Math.sin(\_rotation_(Math.PI/180));  
[color=lime]gotoAndPlay(2)[/color]}  
if (Key.isDown(Key.DOWN)) {  
\_y += speed_Math.cos(\_rotation_(Math.PI/180));  
\_x -= speed_Math.sin(\_rotation_(Math.PI/180));  
[color=#00ff00]gotoAndPlay(2)[/color]}  
}[/color]  
[color=#ff0000][/color]  
[color=black]it wil play the animation but if u hold the (key UP) it wil stop at the first frame[/color]

How can i make it so it will loop without releasing the up key?

Thnx in advance Pancake
