Skip to content

Instantly share code, notes, and snippets.

@geraldyeo
Created November 9, 2010 04:39
Show Gist options
  • Save geraldyeo/668709 to your computer and use it in GitHub Desktop.
Save geraldyeo/668709 to your computer and use it in GitHub Desktop.
Enter key prevention in multiline textfield
textfield.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
private function keyHandler(event:KeyboardEvent):void {
if(event.type == KeyboardEvent.KEY_UP && event.keyCode == Keyboard.ENTER) {
event.target.text = event.target.text.replace("\r", "");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment