The TextArea control is a multiline, editable text field with a border and optional scroll bars. The TextArea control supports the HTML and rich text rendering capabilities of Flash Player and AIR. The TextArea control dispatches change and textInput events.
For complete reference information, see the Adobe Flex Language Reference.
The following image shows a TextArea control:
To create a single-line, editable text field, use the TextInput control. For more information, see TextInput control. To create noneditable text fields, use the Label and Text controls. For more information, see Label control and Text control.
If you disable a TextArea control, it displays its contents in a different color, represented by the disabledColor style. You can set a TextArea control's editable property to false to prevent editing of the text. You can set a TextArea control's displayAsPassword property to conceal input text by displaying characters as asterisks.
You define a TextArea control in MXML by using the <mx:TextArea> tag, as the following example shows. Specify an id value if you intend to refer to a control elsewhere in your MXML, either in another tag or in an ActionScript block.
<?xml version="1.0"?> <!-- textcontrols/TextAreaControl.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:TextArea id="textConfirm" width="300" height="100" text="Please enter your thoughts here."/> </mx:Application>The executing SWF file for the previous example is shown below:
Just as you can for the Text control, you use the text property to specify a string of raw text, and the htmlText property to specify an HTML-formatted string. For more information, see Using the text property and Using the htmlText property.
The TextArea control does not resize to fit the text that it contains. If the new text exceeds the capacity of the TextArea control and the horizontalScrollPolicy is true (the default value), the control adds a scrollbar.