11 Replies Latest reply on Oct 5, 2006 7:52 PM by kglad

    Listener's NOT listening!

    IwannaFlashU Level 1
      WoW! I haven't been here since adobe took over! haha

      OK, one thing I have always hated about Flash and could never understand why they did it this way, is the input text box....ANY OTHER program out there uses the ENTER key to submit the user's response, NOT a submit button. But I didn't let that stop me. I use the following code to accomplish this:

      ===============================================
      var keyListener = new Object();
      keyListener.onKeyUp = function() {
      if (Key.getAscii() == Key.ENTER) {
      if (_root.accessCode == "resume") {
      gotoAndPlay("right");
      } else {
      gotoAndPlay("wrong");
      }
      }
      };
      Key.addListener(keyListener);
      ===============================================

      Now, I have used this code for the past three years with NO PROBLEM. But for some reason, this code in my current project only works in test mode.......and that could be, because in test mode, flash uses the enter key to advance your timeline.

      When I say it doesn't work...it does NOTHING when you hit the enter key. I have tried both getAscii and getCode commands as well. It works fine when I hit control enter, to test it. But when I open up the swf file created, THEN it does nothing.

      Anyone see what's wrong with this code? Because I can't find it.

      thanks!