2 Replies Latest reply on Dec 26, 2006 9:57 AM by flexjv

    Get id of target in global keyboard event handler

    flexjv
      Hi guys,
      I created a global keyboard handler and it works great.

      However, I can't seem to figure out a way to get the id of the target of a keyboard event when I trap the ESCAPE key...

      quote:


      private function trapKeys(e:KeyboardEvent):void {
      switch(e.keyCode)
      {
      case Keyboard.LEFT:
      sel.value=Math.max(0,sel.value-1);
      e.stopPropagation();
      break;
      case Keyboard.RIGHT:
      sel.value=Math.min(sel.maximum, sel.value+1);
      e.stopPropagation();
      case 27: //escape key - THIS IS WHERE I HAVE A PROBLEM
      if (e.target == filterTextInput) { // if the target of the escape key is the filter Text Input field
      filterTextInput.text="";
      filterTextInput.dispatchEvent(new Event(flash.events.Event.CHANGE));
      e.stopPropagation();
      }
      break;
      default:
      }
      }



      Any idears?

      Thanks in advance!