1 Reply Latest reply on Jul 12, 2007 10:48 PM by butcho

    Key.SPACE bug?

    tippedOver
      Try this little program on the main timeline and you'll find that if you press SHIFT + RIGHT + SPACE all at the same time it will trace out "space" yet if you try SHIFT + LEFT + SPACE then nothing? Why wont it work with the left arrow key? I'm programming a game and LEFT is for moving left SHIFT is for running and SPACE is for jumping but I can't run left and jump. Am I missing something?

      this.onEnterFrame = function(){
      if(Key.isDown(Key.SPACE)){
      trace("space");
      }
      }

      Thanks in advance for any shedding any light on this.
        • 1. Re: Key.SPACE bug?
          Level 1
          Well i tried that (im always in a hurry to try some potential bugs) but everything work fine. I did have a "space" traced everytime, whatever the key combination ... and i did try a lot on random.

          Wich version of Flash are you using? I did my test on CS3.

          So i need some more information to help you.
          But i would suggest that you get rid of the onEnterFrame loop in favor of listener.

          var keyListener:Object = new Object();
          keyListener.onKeyDown = onCheckKeyDown;
          Key.addListener(keyListener);

          function onCheckKeyDown(){
          if (Key.isDown(Key.SPACE)) {
          trace("space");
          }
          }

          If you need more information about listener, feel free to ask!! Its really a great feature!