User Guide
Text object 307
Text object
Inheritance Element object > Text object
Availability
Flash MX 2004.
Description
The Text object represents a single text item in a document. All properties of the text pertain to
the entire text block.
To set properties of a text run within the text field, see “Property summary for the TextRun
object” on page 322. To change properties of a selection within a text field, you can use
document.setElementTextAttr() and specify a range of text, or use the current selection.
To set text properties of the selected text field, use
document.setElementProperty(). The
following example assigns the currently selected text field to the variable
textVar:
fl.getDocumentDOM().setElementProperty("variableName", "textVar");
Method summary for the Text object
In addition to the Element object methods, you can use the following methods with the
Text object:
Property summary for the Text object
In addition to the Element object properties, the following properties are available for the
Text object:
Method Description
text.getTextAttr() Method; retrieves the specified attribute for the text identified by the
optional
startIndex and endIndex parameters.
text.getTextString() Method; retrieves the specified range of text.
text.setTextAttr() Method; sets the specified attribute associated with the text identified by
startIndex and endIndex.
text.setTextString() Method; changes the text string within this text object.
Property Description
text.accName Property; a string that is equivalent to the Name field in the Accessibility
panel.
text.autoExpand Property; a Boolean value that controls the expansion of the bounding
width for static text fields or the bounding width and height for dynamic
or input text.
text.border Property; a Boolean value that controls whether Flash shows (true) or
hides (
false) a border around dynamic or input text.
text.description Property; a string that is equivalent to the Description field in the
Accessibility panel.
CHAPTER 3
Objects