Key up/down problem

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 -->

To make him go to idle, type:

onClipEvent (keUp) {
if (Key.getCode() == Key.RIGHT) {
this.gotoAndStop(“idle”);
}
if (Key.getCode() == Key.LEFT) {
this.gotoAndStop(“idle”);
}
}

That should do it :).

P.S. I use to have problems with the keUp factor too.

peace