Inheritance Element object > Text object
Flash MX 2004.
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 the Property summary for the TextAttrs object. 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 generic properties of the selected text field, use document.setElementProperty(). The following example sets the x value of the selected text field's registration point to 50:
fl.getDocumentDOM().setElementProperty("x", 50);
In addition to the Element object methods, the following methods are available for 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. |
In addition to the Element object properties, the following properties are available for the Text object:
| Property | Description |
|---|---|
| text.accName | A string that is equivalent to the Name field in the Accessibility panel. |
| text.antiAliasSharpness | A float value that specifies the anti-aliasing sharpness of the text. |
| text.antiAliasThickness | A float value that specifies the anti-aliasing thickness of the text. |
| text.autoExpand | 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 | A Boolean value that controls whether Flash shows (true) or hides (false) a border around dynamic or input text. |
| text.description | A string that is equivalent to the Description field in the Accessibility panel. |
| Property | Description |
|---|---|
| text.embeddedCharacters | A string that specifies characters to embed. This is equivalent to entering text in the Character Embedding dialog box. |
| text.embedRanges | A string that consists of delimited integers that correspond to the items that can be selected in the Character Embedding dialog box. |
| text.embedVariantGlyphs | A Boolean value that specifies whether to enable the embedding of variant glyphs. |
| text.filters | An array of filters applied to the text element |
| text.fontRenderingMode | A string that specifies the rendering mode for the text. |
| text.length | Read-only; an integer that represents the number of characters in the Text object. |
| text.lineType | A string that sets the line type to "single line", "multiline", "multiline no wrap", or "password". |
| text.maxCharacters | An integer that specifies the maximum characters the user can enter into this Text object. |
| text.orientation | A string that specifies the orientation of the text field. |
| text.renderAsHTML | A Boolean value that controls whether Flash draws the text as HTML and interprets embedded HTML tags. |
| text.scrollable | A Boolean value that controls whether the text can (true) or cannot (false) be scrolled. |
| text.selectable | A Boolean value that controls whether the text can (true) or cannot (false) be selected. Input text is always selectable. |
| text.selectionEnd | A zero-based integer that specifies the offset of the end of a text subselection. |
| text.selectionStart | A zero-based integer that specifies the offset of the beginning of a text subselection. |
| text.shortcut | A string that is equivalent to the Shortcut field in the Accessibility panel. |
| text.silent | A Boolean value that specifies whether the object is accessible. |
| text.tabIndex | An integer that is equivalent to the Tab Index field in the Accessibility panel. |
| text.textRuns | Read-only; an array of TextRun objects. |
| text.textType | A string that specifies the type of text field. Acceptable values are "static", "dynamic", and "input". |
| text.useDeviceFonts | A Boolean value. A value of true causes Flash to draw text using device fonts. |
| text.variableName | A string that contains the contents of the Text object. |