318
Chapter 3: Objects
Description
Property; changes the text string within this text object. If you omit the optional parameters, the
whole text object is replaced. If you specify only
startIndex
, the specified string is inserted at the
startIndex
position. If you specify both
startIndex
and
endIndex
, the specified string replaces
the segment of text starting from
startIndex
up to, but not including,
endIndex
.
Example
The following example assigns the string
"this is a string"
to the selected text field:
fl.getDocumentDOM().selection[0].setTextString("this is a string");
The following example inserts the string
"abc"
beginning at the fifth character of the selected text
field:
fl.getDocumentDOM().selection[0].setTextString("01234567890");
fl.getDocumentDOM().selection[0].setTextString("abc", 4);
// text field is now "0123abc4567890"
The following example replaces the text from the third through the eighth character of the
selected text string with the string
"abcdefghij"
. Characters between
startIndex
and
endIndex
are overwritten. Characters beginning with
endIndex
follow the inserted string.
fl.getDocumentDOM().selection[0].setTextString("01234567890");
fl.getDocumentDOM().selection[0].setTextString("abcdefghij", 2, 8);
// text field is now 01abcdefghij890"
text.shortcut
Availability
Flash MX 2004.
Usage
text.shortcut
Description
Property; a string that is equivalent to the Shortcut field in the Accessibility panel. The shortcut is
read by the screen reader. This property cannot be used with dynamic text.
Example
The following example gets the shortcut key of the selected object and shows the value:
var theShortcut = fl.getDocumentDOM().selection[0].shortcut;
fl.trace(theShortcut);
The following example sets the shortcut key of the selected object:
fl.getDocumentDOM().selection[0].shortcut = "Ctrl+i";
Содержание FLASH MX 2004-FLASH JAVASCRIPT DICTIONARY
Страница 1: ...Flash JavaScript Dictionary ...
Страница 16: ...16 Contents ...
Страница 40: ...40 Chapter 2 Top level functions ...
Страница 368: ...368 Chapter 3 Objects ...
Страница 386: ...386 Chapter 4 C Level Extensibility ...