
Selection.setSelection() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
755
// Finally, assign the new focus.
Selection.setFocus(path + "." + tabOrder[nextFocus]);
}
}
}
// CODE ON BUTTON ON MAIN TIMELINE
on (keyPress "<Tab>") {
// This placeholder code just traps the Tab key in Internet Explorer
var tabCatcher = 0;
}
See Also
MovieClip.focusEnabled, Selection.getFocus(), Selection.setSelection(), TextField.
selectable
, TextField.tabEnabled
Selection.setSelection() Method
select characters in the text field with focus, or set the insertion point
Flash 5
Selection.setSelection(beginIndex, endIndex)
Arguments
beginIndex A nonnegative integer specifying the index of the first character to be
included in the new selection.
endIndex A nonnegative integer specifying the index of the character after the last char-
acter to be included in the new selection.
Description
The setSelection() method selects (highlights) the characters from beginIndex to endIndex –1
in the text field with focus. If no field has focus, setSelection() has no effect. It commonly is
used to highlight problematic user input. To replace the text in the current selection, use
TextField.replaceSel().
Usage
Though the Selection object does not have a “setCaretIndex” method, we can use the
setSelection() method to set the insertion point