ActionScript 2.0 Components Language Reference |
|
|
|
| TextArea component > Using the TextArea component > 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:
/**
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;
|
|
|
|