Text.shortcut – Adobe Extending Flash Professional CS5 User Manual
Page 470
448
EXTENDING FLASH PROFESSIONAL
Text object
Last updated 5/2/2011
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";