# Problem running animation

**URL:** <https://forum.kirupa.com/t/problem-running-animation/273022>\
**Category:** flash\
**Created:** [October 10, 2008, 10:36am UTC](https://forum.kirupa.com/t/problem-running-animation/273022 "2008-10-10T10:36:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![StormWhaler](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@StormWhaler](https://forum.kirupa.com/u/StormWhaler)\
**Post date:** [October 10, 2008, 10:36am UTC](https://forum.kirupa.com/t/problem-running-animation/273022/1 "2008-10-10T10:36:30Z")

</div>

I have just started making a simple platform game and have some problems triggering a animation when I press a (keyboard)button/when something is happening.

I use this function to change the animation

function changeAnimation(anim:String):void{  
if(player.currentLabel != anim){  
player.gotoAndStop(anim);  
}  
}

And it actually works here

if (right == true) {  
player.x+=speed;  
player.scaleX = 1;  
changeAnimation(“run”);  
}

But when I try to run the jump animation it only runs the first frame and not the whole animation.

if (space == true) {  
isJumping = true;  
}  
if(isJumping ==true){  
changeAnimation(“jump”);  
player.y -= jumpSpeed;  
jumpSpeed --;

```
    if(this.Bakke.hitTestPoint(this.player.x, this.player.y+145, true)){
        jumpSpeed = 20;
        isJumping = false;

```

Anyone know whats wrong?
