3 Replies Latest reply on Mar 2, 2012 9:08 PM by Flex harUI

    event.target.id does not work for TextInputs?

    PagePageUI

      Hello,

       

      So i need to get the id of a keyboard event for buttons and textInput. Depending on the ID of the component, the focus is set. When the focus is on a button and an event is dispatch, the event.target.id is the name of the button that dispathed the event but when the textInput dispatches the event, the event.target.id is not the id of the textInput component. Is there a way i can get the ID of the textInput from the the dispatched event. Please help me out.

       

      Here is a snipit of my code:

       

       

      In the script block of the main application mxml file

      ....

      ....

      <fx:Script>

      ....

      ...

      protected function handle_keypress(event:KeyboardEvent):void

      {

              var key:Number = event.keyCode;

              var pattern:String = event.target.id;

              trace('id is: ' + pattern); //output for button is btn1, output for textInput is textDisplay instead of txtipt1

      ......

      .....

      }

       

       

      mxml code in main application

      ....

      ....

      <s:Button id="btn1"/>

      <s:TextInput id="txtipt1"/>