TextField object

Availability

Flash Player 6.

Description

All dynamic and input text fields in a Flash movie are instances of the TextField object. You can give a text field an instance name in the Property inspector and use the methods and properties of the TextField object to manipulate it with ActionScript. TextField instance names are displayed in the Movie Explorer and in the Insert Target Path dialog box in the Actions panel.

The TextField object inherits from the Object object.

To create a text field dynamically, you can use MovieClip.createTextField().

Method summary for the TextField object

Method Description
TextField.addListener() Registers an object to receive notification when the onChanged and onScroller event handlers are invoked.
TextField.getDepth() Returns the depth of a text field.
TextField.getNewTextFormat() Gets the default text format assigned to newly inserted text.
TextField.removeListener() Removes a listener object.
TextField.removeTextField() Removes a text field that was created with MovieClip.createTextField().
TextField.replaceSel() Replaces the current selection.
TextField.setNewTextFormat() Sets a text format object for text that is inserted by a user or by a method.
TextField.setTextFormat() Sets the default text format assigned to newly inserted text.

Property summary for the TextField object

Property Description
TextField._alpha The transparency value of a text field instance.
TextField._alpha Controls automatic alignment and sizing of a text field.
TextField.background Indicates if the text field has a background fill.
TextField.backgroundColor Indicates the color of the background fill.
TextField.border Indicates if the text field has a border.
TextField.borderColor Indicates the color of the border.
TextField.bottomScroll The bottommost visible line in a text field. Read-only.
TextField.embedFonts Indicates whether the text field uses embedded font outlines or device fonts.
TextField._height The height of a text field instance in pixels. This only affects the bounding box of the text field, it does not affect the border thickness or text font size.
TextField._highquality Indicates the rendering quality of the movie.
TextField.hscroll Indicates the horizontal scroll value of a text field.
TextField.html Indicates the current maximun scrolling position of a text field.
TextField.htmlText Contains the HTML representation of a text field's contents.
TextField.length The number of characters in a text field. Read-only.
TextField.maxChars The maximum number of characters that a text field can contain.
TextField.maxhscroll The maximum value of TextField.hscroll. Read-only.
TextField.maxscroll The maximum value of TextField.scroll. Read-only.
TextField.menu  
TextField.mouseWheelEnabled  
TextField.multiline Indicates if the text field contains multiple lines.
TextField._name The instance name of a text field instance.
TextField._parent A reference to the instance that is the parent of this instance; either of type Button or MovieClip.
TextField.password Indicates if a text field hides the input characters.
TextField._quality Indicates the rendering quality of a movie.
TextField.restrict The set of characters that a user can enter into a text field.
TextField._rotation The degree of rotation of a text field instance.
TextField.scroll Indicates the current scrolling position of a text field.
TextField.selectable Indicates whether a text field is selectable.
TextField._soundbuftime The amount of time a sound must prebuffer before it streams.
TextField.tabEnabled Indicates whether a movie clip is included in automatic tab ordering.
TextField.tabIndex Indicates the tab order of an object.
TextField._target The target path of the specified text field instance. Read-only.
TextField.text The current text in the text field.
TextField.textColor The color of the current text in the text field.
TextField.textHeight The height of the text field's bounding box.
TextField.textWidth The width of the text field's bounding box.
TextField.type Indicates whether a text field is an input text field or dynamic text field.
TextField._url The URL of the SWF file that created the text field instance. Read-only.
TextField.variable The variable name associated with the text field.
TextField._visible A Boolean value that determines whether a text field instance is hidden or visible.
TextField._width The width of a text field instance in pixels. This only affects the bounding box of the text field, it does not affect the border thickness or text font size.
TextField.wordWrap Indicates whether the text field word-wraps.
TextField._x The x coordinate of a text field instance
TextField._xmouse The x coordinate of the pointer relative to a text field instance. Read-only.
TextField._xscale The value specifying the percentage for horizontally scaling a text field instance.
TextField._y The y coordinate of a text field instance.
TextField._ymouse The y coordinate of the pointer relative to a text field instance. Read-only.
TextField._yscale The value specifying the percentage for vertically scaling a text field instance.

Event handler summary for the TextField object

Event handler Description
TextField.onChanged Invoked when the text field is changed.
TextField.onKillFocus Invoked when the text field loses focus.
TextField.onScroller Invoked when the scroll, maxscroll, hscroll, maxhscroll, or bottomscroll property of a text field changes.
TextField.onSetFocus Invoked when the text field receives focus.

Listener summary for the TextField object

Method Description
TextField.onChanged Notified when the text field is changed.
TextField.onScroller Notified when the scroll or maxscroll property of a text field changes.