TextInput class

Inheritance UIObject > UIComponent > TextInput

ActionScript Class Namespace mx.controls.TextInput

The properties of the TextInput class allow you to set the text content, formatting, and horizontal position at runtime. You can also indicate whether the field is editable, and whether it is a "password" field. You can also restrict the characters that a user can enter.

Setting a property of the TextInput class with ActionScript overrides the parameter of the same name set in the Property inspector or Component Inspector panel.

The TextInput component uses the FocusManager to override the default Flash Player focus rectangle and draw a custom focus rectangle with rounded corners. For more information, see FocusManager class.

The TextInput component supports CSS styles and any additional HTML styles supported by Flash Player. For information about CSS support, see the W3C specification.

You can manipulate the text string by using the string returned by the text object.

Each component class has a version property which is a class property. Class properties are only available on the class itself. The version property returns a string that indicates the version of the component. To access the version property, use the following code:

trace(mx.controls.TextInput.version);

Note: The following code returns undefined: trace(myTextInputInstance.version);.

Method summary for the TextInput class

Inherits all methods from UIObject class and UIComponent class.

Property summary for the TextInput class

Property

Description

TextInput.editable

A Boolean value indicating whether the field is editable (true) or not (false).

TextInput.hPosition

The horizontal scrolling position of the text field.

TextInput.length

The number of characters in a TextInput text field. This property is read-only.

TextInput.maxChars

The maximum number of characters that a user can enter in a TextInput text field.

TextInput.maxHPosition

The maximum possible value for TextField.hPosition. This property is read-only.

TextInput.password

A Boolean value that indicates whether or not the input text field is a password field that hides the entered characters.

TextInput.restrict

Indicates which characters a user can enter in a text field.

TextInput.text

Sets the text content of a TextInput text field.

Inherits all methods from UIObject class and UIComponent class.

Event summary for the TextInput class

Event

Description

TextInput.change

Triggered when the Input field changes.

TextInput.enter

Triggered when the enter key is pressed.

Inherits all methods from UIObject class and UIComponent class.