Skip to main content
Participant
Jul 3, 2010 6:28 PM UTC
Question

Automatically Inserting Caret After Text Displays

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 is closed to new replies. Start a new post to keep the conversation going.

2 replies

Participant
Jul 3, 2010 6:57 PM UTC

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.

Translate
Inspiring
Jul 7, 2010 3:08 AM UTC

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

Richard

Translate