# TLF and the Enter Key

**URL:** <https://forum.kirupa.com/t/tlf-and-the-enter-key/313850>\
**Category:** flash\
**Created:** [September 11, 2010, 6:02pm UTC](https://forum.kirupa.com/t/tlf-and-the-enter-key/313850 "2010-09-11T18:02:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vivogd](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vivogd](https://forum.kirupa.com/u/vivogd)\
**Post date:** [September 11, 2010, 6:02pm UTC](https://forum.kirupa.com/t/tlf-and-the-enter-key/313850/1 "2010-09-11T18:02:47Z")

</div>

hi,

i’m trying to do a basic thing, making an chat box using input text field in as3 with the new TLF format. (CS5 new thing for none latin speaking people)  
As it is the TLF has no enter event.  
I tried to bypass it by making a KEY\_DOWN keyboard event whenever the text field is in focus but I get no recognition  
on key-code 13.

All I want is for the enter key to do something with the text. help???

here is the bypassed code.

thanks,

Aviv

txtChat.addEventListener (FocusEvent.FOCUS\_IN,onChatFocusIn)  
txtChat.addEventListener (FocusEvent.FOCUS\_OUT,onChatFocusOut)  
stage.addEventListener( KeyboardEvent.KEY\_DOWN, onChatKeyPress);

private function onChatKeyPress(e:KeyboardEvent):void  
{  
if (e.keyCode == 13 && isInFocus) doSomething();  
}  
private function onChatFocusIn(e:FocusEvent) {  
isInFocus = true;  
}  
private function onChatFocusOut(e:FocusEvent) {  
isInFocus = false;  
}
