# Key up/down problem

**URL:** https://forum.kirupa.com/t/key-up-down-problem/121294
**Category:** Uncategorized
**Created:** [September 1, 2004, 7:25pm UTC](https://forum.kirupa.com/t/key-up-down-problem/121294 "2004-09-01T19:25:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![KrustyJoe](https://avatars.discourse-cdn.com/v4/letter/k/fbc32d/32.png) [@KrustyJoe](https://forum.kirupa.com/u/KrustyJoe)
#### Post date: [September 1, 2004, 7:25pm UTC](https://forum.kirupa.com/t/key-up-down-problem/121294/1 "2004-09-01T19:25:07Z")

</div>

K if my sprite is running and my code for that lets say the code is

if (Key.isDown(Key.LEFT)) {  
\_root.hero.gotoAndstop(2);  
this.\_xscale = -100;  
}  
if (Key.isDown(Key.RIGHT)) {  
\_root.hero.gotoAndstop(2);  
this.\_xscale = 100;  
}

k for example thats how my guy runs.

now is there some way to incorporate some thing that lets just say while ur running to the right and then u let go of the right key. how do u make the sprite go to idle frame.  
is it something like

if (Key.isDown(Key.RIGHT) && Key.isUP(Key.RIGHT)  
\_root.hero.gotoAndstop(1);  
this.\_xscale = 100;  
}

im not sure exactly wat to do  
\<!-- / message --\>
