2 Replies Latest reply on Mar 16, 2007 12:39 PM by Newsgroup_User

    help please resetting a listener

    RichieDee
      Hi,
      Im trying to create a game for my 1 year old in flash that shows a letter on the screen. He has to press that letter on the keyboard to move on to the next letter.

      So far Ive got this...(for letter a)

      Code:
      stop ();
      var myListener:Object = new Object();
      myListener.onKeyDown = function() {
      if (Key.getCode() == 65) {
      play();
      }
      };
      Key.addListener(myListener);


      the problem is, when I get to letter b and put this...

      Code:
      stop ();
      var myListener:Object = new Object();
      myListener.onKeyDown = function() {
      if (Key.getCode() == 66) {
      play();
      }
      };
      Key.addListener(myListener);


      "a" still works. How can I make it so the listener, "resets" or "forgets" any previous letter?

      Thanks!
      Rich