TextArea.maxChars

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

textAreaInstance.maxChars

Description

Property; the maximum number of characters that the text area can contain. A script may insert more text than the maxChars property allows; the property indicates only how much text a user can enter. If the value of this property is null, there is no limit to the amount of text a user can enter. The default value is null.

Example

The following example sets the maxchars property to limit the number of characters a user can enter to 24.

You must first add an instance of the TextArea component to the Stage and name it my_ta; then add the following code to Frame 1.

/**
 Requires:
  - TextArea instance on Stage (instance name: my_ta)
*/

var my_ta:mx.controls.TextArea;

my_ta.maxChars = 24;

// Define a listener object.
var taListener:Object = new Object();
taListener.change = function(evt_obj:Object) {
 trace("my_ta.length is now: " + my_ta.length + " characters");
};
my_ta.addEventListener("change", taListener);