AS3 TextField setSelection not work
Recently I was having problems using setSelection on a textfield using a FOCUS_IN event callback. It simply wasn’t working as I expected.
I found the solution in the comments of one of Ryan Henson Creighton’s blog posts:
http://www.untoldentertainment.com/blog/2008/01/11/as3-pitfalls-textfieldsetselection-not-working/
The solution (by Eightlines) is simple..
FocusEvent.FOCUS_IN does not allow setSelection() to operate as expected. Changed it to MouseEvent.CLICK and it works correctly.
Use a CLICK MouseEvent instead of the FOCUS_IN event.