Take the 2-minute tour ×

I've a TextArea that I want to use for code input (xml). How do I allow for entering tabs (pressing tab moves focus to nect control)?

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

The only way I've found to do this is the extend TextArea and catch it's keyFocusChange event, then stop the event and insert the tab. Here is an example:


  <mx:Component className="MyTextArea">
    <mx:TextArea width="300" height="300">

  <MyTextArea width="300" height="300"/>

  <mx:TextArea width="300" height="300"/>


You can also break the MyTextArea out into a separate class file. But I put it all in one file because it's easier to test.

share|improve this answer
add comment


<mx:TextArea width="300" height="300" keyFocusChange="event.preventDefault();event.target.replaceSelectedText('\t');"/>
share|improve this answer
add comment

Your Answer


