1 Reply Latest reply on Jun 22, 2007 7:07 AM by kglad

    key listener for just number and letters?

      Hi All,

      I have a key listener set up as in this snippit:
      var keyListener:Object = new Object();
      this.keyListener.onKeyDown = function() {
      trace("DOWN -> Code: " + Key.getCode() + "\tACSII: " + Key.getAscii() + "\tKey: " + chr(Key.getAscii()));
      trace(isPropertyEnumerable(Key)); // Output: true
      All works fine, but I'm wanting to perform certain actions when the user inputs numbers and letters only. Is there an easy way of doing this or do I have to create an array with ALL the number and letter ASCII codes to compare against?

      Kind regards
        • 1. Re: key listener for just number and letters?
          kglad Adobe Community Professional & MVP
          create an array. it's quick and easy if you work cleverly.

          create an empty array and push your ascii keypress codes into it. then test your project and keypress the numbers and letters in the order you want them to be listed in your array.

          when you're finished trace your array (in order), copy the output panel and in the authoring environment paste your ascii array.