1 Reply Latest reply on Jul 19, 2007 6:59 PM by everynewday

    Key press

    joesmoes
      Hey all!

      Here is a script that i made...

      on (release, keyPress "a") {
      gotoAndStop(3);
      }


      I'm want to allow a user to press a letter on the keyboard, then have them sent to a frame and then stop!

      Also i want to have it so i can list from A - Z, each leer goes to a different frame!


      if some one knows how to correct my error please help me.

      Thanks,
      Jimmy

        • 1. Re: Key press
          everynewday
          This would be the correct syntax:

          var keyListener:Object = new Object();
          keyListener.onKeyDown = function() {
          if(Key.getCode() == 65) {
          gotoAndStop(3);
          }
          };
          Key.addListener(keyListener);

          Each key has its own individual code. If you look up key codes in the Flash help, you'll find a list of all of them. Some keys can be declared by name, but others need to be declared by their code.