# Error 1119 while trying to check if Enter key is pressed?

**URL:** <https://forum.kirupa.com/t/error-1119-while-trying-to-check-if-enter-key-is-pressed/224187>\
**Category:** flash\
**Created:** [April 29, 2007, 7:14pm UTC](https://forum.kirupa.com/t/error-1119-while-trying-to-check-if-enter-key-is-pressed/224187 "2007-04-29T19:14:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JMowery](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jmowery/32/3565_2.png) [@JMowery](https://forum.kirupa.com/u/JMowery)\
**Post date:** [April 29, 2007, 7:14pm UTC](https://forum.kirupa.com/t/error-1119-while-trying-to-check-if-enter-key-is-pressed/224187/1 "2007-04-29T19:14:11Z")

</div>

```auto

txt_input.addEventListener(KeyboardEvent.KEY_UP, eventResponse);

function eventResponse(event:Event):void
{
    if(event.keyCode == Keyboard.ENTER)
    {
        trace("Enter Key Pressed!");
    }
}

stop();

```

txt\_input is a text input field on the stage.

I am running Flash CS3, and am new to actionscript and such, but I have been trying to get that code to work, and in examples, it shows that it works, but, I for some reason get the following error:

1119: Access of possibly undefined property keyCode through a reference with static type flash.events:Event.

I have searched the internet for hours, and the closest thing I have found is that I have to do some sort of casting thing or something, but I’m not sure how to do this.

The only result that came up was in this forum, with the casting thing, so help on how to properly do that is what I need.

So if anyone has an idea as to how to fix this, I’d be much appreciative 🙂
