ActionScript Setting Caret Position In Text Layout Framework
i'm attempting to simply set the caret position at the start of the text flow when it is first displayed, without having to click and activate the text to see the blinking caret.
googling returns that the solution is开发者_高级运维 to do this:
textFlow.interactionManager = new EditManager(new UndoManager());
textFlow.interactionManager.setSelection(0, 0);
however, setSelection() is not a valid function of the selection or edit managers.
1061: Call to a possibly undefined method setSelection through a reference with static type flashx.textLayout.edit:ISelectionManager.
figured it out. for anyone else who ever has to deal with the nightmare that is the text layout framework documentation, you can automatically position and display the blinking caret after the text is displayed by writing this:
textFlow.interactionManager.selectRange(0, 0);
textFlow.interactionManager.setFocus();
精彩评论