Hello. I have a new blog.

I've moved this blog to the following URL Kerkness.ca. Thank you for visiting, please update your bookmarks.

Wednesday, February 20, 2008

Flex FocusManager and Cursor control

Working on a component which needs to programatically set focus to a TextInput field and make sure that the cursor is placed at the end of current value. I found this possible by using both the Flex FocusManager and also the setSelection() method of TextInput. Figured the code snippit might be useful to other people so here it is.

//assuming myInputField is the id of a TextInput field
focusManager.setFocus(myInputField);
myInputField.setSelection(myInputField.length, myInputField.length);

1 comment:

Thank you for the comments.