   Flash (AS 2.0) game problem
  Hey guys, I'm trying to program a side scroller where the player can move left and right and attack.  If the player is not performing an action (in this case walking or attacking) it plays an idle animation called 'still'.My problem is that if the player is holding left or right and presses the spacebar (attack), and then releases the left or right key, the player will stop (as they should) but the walking animation will continue to play as though they were still moving.In other words:  if the player is holding the left or right key and presses attack, performingAction will become true and remain true even when key is released.This problem is fixed the moment the player changes directions or attacks while standing still.If anyone could help me figure this out I'd really appreciate it.onClipEvent (load) {speed = 15;    //player speedscale = _xscale//player x scaleperformingAction = false;//is the player performing an actionattacking = false;  //is the player attackingkeyheld = false;    //is the attack key being held down}onClipEvent (enterFrame) {if(!performingAction){    //if the player is not performing action, play the 'still' animation (idle)gotoAndPlay('still');  }if (Key.isDown(Key.LEFT) && !attacking) { //if the left arrow key is down and the player is not attacking, play the walking animation, flip the x scale, and change performing action to truegotoAndStop('walking');_x -= speed;_xscale = -scale;performingAction = true;}var leftKeyUpListener = new Object();    //left key up listener:  if the left key is up, change performing action back to falseleftKeyUpListener.onKeyUp = function() {if (Key.LEFT == Key.getCode()) {performingAction = false;}}if (Key.isDown(Key.RIGHT)&& !attacking) {  //if the right arrow key is down and the player is not attacking, play the walking animation, flip the x scale, and change performing action to truegotoAndStop('walking');_x += speed;_xscale = scale;performingAction = true;}var rightKeyUpListener = new Object();  //right key up key listener:  if the right key is up, change performing action back to falserightKeyUpListener.onKeyUp = function() {if (Key.RIGHT == Key.getCode()) {performingAction = false;}}var spaceDownKeyListener = new Object();    // space down key listener:  if the space key is down, play the attack animtion, attacking is true, attack key held is true, and performing action is true;spaceDownKeyListener.onKeyDown = function() {if (Key.SPACE == Key.getCode() && !keyheld && !attacking) {gotoAndPlay('attack');attacking = true;keyheld = true;performingAction = true;}}var spaceUpKeyListener = new Object();  //space key up listener: if the space key is up the attack key held is false.  performing action and attacking both become false when the attack animation finishes (not shown here)spaceUpKeyListener.onKeyUp = function() {if (Key.SPACE == Key.getCode()) {keyheld = false;}}Key.addListener(leftkeyUpListener);Key.addListener(rightKeyUpListener);Key.addListener(spaceUpKeyListener);Key.addListener(spaceDownKeyListener);Key.addListener(WeaponKeyListener);}thanks for reading   