The following example gets the text fill color of the selected text field:
var TheFill = fl.getDocumentDOM().selection[0].getTextAttr("fillColor");
fl.trace(TheFill);
The following example gets the size of the third character:
var Char2 = fl.getDocumentDOM().selection[0].getTextAttr("size", 2);
fl.trace(Char2);
The following example gets the color of the selected text field from the third through the eighth
character:
fl.getDocumentDOM().selection[0].getTextAttr("fillColor", 2, 8);
text.getTextString()
Availability
Flash MX 2004.
Usage
text.getTextString([startIndex [, endIndex] ])
Parameters
An integer that specifies the index (zero-based) of the first character. This
startIndex
parameter is optional.
An integer that specifies the end of the range of text, which starts from
endIndex
and goes up to, but not including,
Returns
A string of the text in the specified range.
Description
Method; retrieves the specified range of text. If you omit the optional parameters
and
, the whole text string is returned. If you specify only
endIndex
returns the string starting at the index location and ending at the end of the field. If you specify
both
startIndex
up to, but not including,
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);
312
Chapter 3: Objects
endIndex
and
, the method returns the string starts from
endIndex
.
endIndex
.This parameter is optional.
startIndex
startIndex
, the method
startIndex
and goes
startIndex
Need help?
Do you have a question about the FLASH MX 2004-FLASH JAVASCRIPT DICTIONARY and is the answer not in the manual?