# Key.getCode() not returning anything for Enter key

**URL:** <https://forum.kirupa.com/t/key-getcode-not-returning-anything-for-enter-key/162721>\
**Category:** Uncategorized\
**Created:** [September 15, 2005, 4:23pm UTC](https://forum.kirupa.com/t/key-getcode-not-returning-anything-for-enter-key/162721 "2005-09-15T16:23:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kernel\_flash](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@kernel\_flash](https://forum.kirupa.com/u/kernel_flash)\
**Post date:** [September 15, 2005, 4:23pm UTC](https://forum.kirupa.com/t/key-getcode-not-returning-anything-for-enter-key/162721/1 "2005-09-15T16:23:37Z")

</div>

I’m using following code to trap the key press events.  
[AS]  
myListener = new Object ();  
myListener.onKeyDown = function ()  
{  
trace(Key.getCode());  
if (Key.getCode()==13)//code for ENTER key is 13  
{  
trace (“asdf”);  
}  
};  
Key.addListener (myListener);  
[/AS]

Now when I hit ENTER nothing is traced and “asdf” isn’t printed,  
while hitting anyother key gives it’s code in output.

Any clue?
