/ Published in: ActionScript 3
Showing an input hint in the TextField itself, hiding it on focus/input, and showing it again when the input is left empty.
Expand |
Embed | Plain Text
var hint:String = "dd-mm-yyyy"; txtDate.text = hint; txtDate.addEventListener(FocusEvent.FOCUS_IN, focusIn); txtDate.addEventListener(FocusEvent.FOCUS_OUT, focusOut); private function focusIn(evt:FocusEvent):void { if (evt.target.text == hint) txtDate.text = ""; } private function focusOut(evt:FocusEvent):void { if (evt.target.text == "") txtDate.text = hint; }
You need to login to post a comment.
