AS3 – Uppercase an input textfield’s contents automatically

Here is a quick snippet on how to automatically set an input textfield’s text to uppercase. (If you do it on the KeyboardEvent.KEY_UP event, the text will initially show as lowercase than change to uppercase.)

text_txt.addEventListener(Event.CHANGE, toUpperCase)

private function toUpperCase(evt:Event):void {
	evt.target.text = evt.target.text.toUpperCase();
}

Comments

Leave a Reply