# Key press Animation help

**URL:** <https://forum.kirupa.com/t/key-press-animation-help/327895>\
**Category:** flash\
**Created:** [April 4, 2012, 1:24pm UTC](https://forum.kirupa.com/t/key-press-animation-help/327895 "2012-04-04T13:24:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MAGG0T](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@MAGG0T](https://forum.kirupa.com/u/MAGG0T)\
**Post date:** [April 4, 2012, 1:24pm UTC](https://forum.kirupa.com/t/key-press-animation-help/327895/1 "2012-04-04T13:24:05Z")

</div>

[COLOR=#000000][FONT=verdana]I have a Animated character which moves Left and right (up and down comming later) lol [/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]Anyway! it walks perfectly when walking RIGHT but when i add the LEFT movement code the animation stops working here is the Right key press code:[/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]sprite= My movieClip [/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]Code:

[/FONT][/COLOR]sprite.onEnterFrame = function(){

if(Key.isDown(Key.RIGHT)){  
this.\_x += 10;  
this.gotoAndStop(2);

}else{  
this.gotoAndStop(1)

}  
}

[COLOR=#000000][FONT=verdana]This works fine with the movement and animation here is the hole code that stops it from working:[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]Code:

[/FONT][/COLOR]sprite.onEnterFrame = function(){

if(Key.isDown(Key.RIGHT)){  
this.\_x += 10;  
this.gotoAndStop(2);

}else{  
this.gotoAndStop(1)  
}  
if(Key.isDown(Key.LEFT)){  
this.\_x += 10;  
this.gotoAndStop(4);

}else{  
this.gotoAndStop(3)

}  
}

[COLOR=#000000][FONT=verdana]

I will attach my FLA file all the Animation is within the sprite MC[/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]I would be so greatful if someone could post my fla file working fully left to right Thanks in advance![/FONT][/COLOR]
