3 Replies Latest reply on Dec 6, 2010 2:45 PM by kglad

    Keys pressed or not pressed



      I am struggling a bit with keys on the keyboards controlling a movieclip to happen.

      Ive got a person moving when pressing right and left, and a movieclip with three frames: First frame is a movieclip with the person standing still, looking bored. The second frame is the person moving right, and the third frame is the person moving left.

      This is the code that Ive inserted into the persons actions on scene1:



      if (Key.isDown(Key.RIGHT)) {
      _x += speed;
      _xscale = +scale;


      if (Key.isDown(Key.LEFT)) {
      _x -= speed;
      _xscale = -scale;


      this code works alright accept that when the keys are not pressed it doesnt stand still, the legs are still moving, so I tried to include this code aswell:


      if (!Key.isDown(KEY.RIGHT)) {
          if (!Key.isDown(KEY.LEFT)) {


      this makes the person standing still when not pressed but not moving the legs when turning right and left.


      What am I doing wrong, any ideas?


      Thank you for any help.