Created
June 19, 2012 13:50
-
-
Save adeolaawoyemi/2954331 to your computer and use it in GitHub Desktop.
Automatically select all text in a TextField when user clicks inside it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_tf.addEventListener(FocusEvent.FOCUS_IN, onFocusIn); | |
my_tf.addEventListener(FocusEvent.FOCUS_OUT, onFocusOut); | |
function onFocusIn(event:FocusEvent):void { | |
setTimeout(event.target.setSelection, 50, 0, event.target.text.length); | |
} | |
function onFocusOut(event:FocusEvent):void { | |
event.target.setSelection(0,0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment