editable
indicates whether the TextArea component is editable (
default value is
true
wordWrap
indicates whether the text wraps (
You can write ActionScript to control these and additional options for the TextArea component
using its properties, methods, and events. For more information, see
on page
728.
Creating an application with the TextArea component
The following procedure explains how to add a TextArea component to an application while
authoring. In this example, the component is a Comment field with an event listener that
determines if a user has entered text.
To create an application with the TextArea component:
Drag a TextArea component from the Components panel to the Stage.
1.
In the Property inspector, enter the instance name comment.
2.
In the Property inspector, set parameters as you wish. However, leave the text parameter blank,
3.
the editable parameter set to
Select Frame 1 in the Timeline, open the Actions panel, and enter the following code:
4.
textListener = new Object();
textListener.handleEvent = function (evt){
if (comment.length < 1)
Alert(_root, "Error", "You must enter at least a comment in this field",
mxModal | mxOK);
}
}
comment.addEventListener("focusOut", textListener);
This code sets up a
that the user typed something in the text field.
Once text is entered in the comment instance, you can get its value as follows:
5.
var login = comment.text;
Customizing the TextArea component
You can transform a TextArea component horizontally and vertically while authoring and at
runtime. While authoring, select the component on the Stage and use the Free Transform tool or
any of the Modify > Transform commands. At runtime, use
applicable properties and methods of the
When a TextArea component is resized, the border is resized to the new bounding box. The scroll
bars are placed on the bottom and right edges if they are required. The text field is then resized
within the remaining area; there are no fixed-size elements in a TextArea component. If the
TextArea component is too small to display the text, the text is clipped.
726
Chapter 6: Components Dictionary
.
, and the password parameter set to
true
{
event handler on the TextArea comment instance that verifies
focusOut
TextArea
true
) or not (
). The default value is
true
false
UIObject.setSize()
class.
) or not (
). The
false
true
"TextArea class"
.
false
or any
.
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?
Questions and answers