Skip to main content
Participant
July 3, 2010
Question

Automatically Inserting Caret After Text Displays

  • July 3, 2010
  • 1 reply
  • 822 views

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.

why must simple things like this be so difficult with the text layout framework?  i'm using the Flex SDK 4.1.

This topic has been closed for replies.

1 reply

Participant
July 3, 2010

i finally figured it out, no thanks to the documentation

textFlow.interactionManager.selectRange(0, 0);

textFlow.interactionManager.setFocus();

that will automatically display a blinking caret before the text after after it is displayed.

Adobe Employee
July 7, 2010

refreshSelection is the other related API.  That API updates the selection shapes.  setFocus has the side effect of possibly changing the focus.

Richard