User Guide

Using the TextArea component 1179
visible is a Boolean value that indicates whether the object is visible (true) or not (false).
The default value is
true.
You can write ActionScript to control these and additional options for the TextArea
component using its properties, methods, and events. For more information, see “TextArea
class” on page 1182.
Creating an application with the TextArea component
The following procedure explains how to add a TextArea component to an application while
authoring. The example sets up a
focusOut event handler on the TextArea instance that
verifies that the user typed something in the text area before giving focus to a different part of
the interface.
To create an application with the TextArea component:
1. Drag a TextArea component from the Components panel to the Stage and give it an
instance name of my_ta.
2. Select Frame 1 in the Timeline, open the Actions panel, and enter the following code:
/**
Requires:
- TextArea instance on Stage (instance name: my_ta)
*/
var my_ta:mx.controls.TextArea;
var taListener:Object = new Object();
taListener.focusOut = function(evt_obj:Object) {
if (my_ta.length < 1) {
trace("Please enter a comment");
}
};
my_ta.addEventListener("focusOut", taListener);
This code sets up a focusOut event handler on the TextArea component instance that
verifies that the user typed something in the text area.
You can get the value of text that is entered in the TextArea instance, as follows:
var ta_text:String = my_ta.text;
NOTE
The minHeight and minWidth properties are used by internal sizing routines. They are
defined in UIObject, and are overridden by different components as needed. These
properties can be used if you make a custom layout manager for your application.
Otherwise, setting these properties in the Component inspector has no visible effect.