1 Reply Latest reply on Nov 21, 2009 12:43 PM by funkysoul

    Clearing the TextArea texts when I press Enter key

    kadaj

      Hello friends,

      I'm new to Adobe Flex.

       

      Aim: I have a custom component named IOField based on TextArea component. Inside the IOField, how to write code that clears the textarea when the user press enter key.

       

      I have the main application this component is added as <comp: IOField/> with xml namespace :comp

       

      Is there any thing in flex like fl.events.ComponentEvent that's present in flash?

       

      I'm trying to do things in OOP way with consideration to performance also.

       

      Please help.

      Thank You.

        • 1. Re: Clearing the TextArea texts when I press Enter key
          funkysoul Level 4

          If you extended the TextArea Component then you can use a small piece of AS3 to get the Keypress and delete the content of the textfield. something like this

           

          AS:

          private function changeEvent(e:KeyboardEvent)

           

                      {

           

                          if(e.keyCode == Keyboard.ENTER)

           

                          {

           

                              myTextArea.text = "";

           

                          }

           

                      }

           

           

           

          MXML:

           

          <mx:TextArea id="myTextArea" keyDown="changeEvent(event)" text=""/>