User Guide

436 Objects
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 466. 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:
Method Description
text.getTextAttr() Retrieves the specified attribute for the text identified by the
optional
startIndex and endIndex parameters.
text.getTextString() Retrieves the specified range of text.
text.setTextAttr() Sets the specified attribute associated with the text identified by
startIndex and endIndex.
text.setTextString() Changes the text string within this text object.
CHAPTER 40
Objects