ProblemYou want ActionScript to set the insertion point for a text field. SolutionUse the TextField.setSelection( ) method. DiscussionYou can use TextField.setSelection( ) to set the cursor position in a text field by setting the beginning and ending index parameters to the same value. This example sets the cursor position in the text field, assuming it has focus: // Positions the insertion point before the first character field.setSelection(0, 0); You can retrieve the index of the cursor position with the read-only caretIndex property: trace(field.caretIndex); See AlsoRecipe 9.21 |