Text.length, Text.linetype – Adobe Extending Flash Professional CS4 User Manual

Page 465

Advertising
background image

443

EXTENDING FLASH CS4 PROFESSIONAL

Text object

Returns
A string of the text in the specified range.

Description
Method; retrieves the specified range of text. If you omit the optional parameters startIndex and endIndex, the whole
text string is returned. If you specify only startIndex, the method returns the string starting at the index location and
ending at the end of the field. If you specify both startIndex and endIndex, the method returns the string starting from
startIndex and goes up to, but does not include, endIndex.

Example
The following example gets the character(s) from the fifth character through the end of the selected text field:

var myText = fl.getDocumentDOM().selection[0].getTextString(4);

fl.trace(myText);

The following example gets the fourth through the ninth characters starting in the selected text field:

var myText = fl.getDocumentDOM().selection[0].getTextString(3, 9);

fl.trace(myText);

text.length

Availability
Flash MX 2004.

Usage

text.length

Description
Read-only property; an integer that represents the number of characters in the Text object.

Example
The following example returns the number of characters in the selected text:

var textLength = fl.getDocumentDOM().selection[0].length;

text.lineType

Availability
Flash MX 2004.

Usage

text.lineType

Description
Property; a string that sets the line type. Acceptable values are

"single line"

,

"multiline"

,

"multiline no wrap"

,

and

"password"

.

Advertising