# Keypress

**URL:** <https://forum.kirupa.com/t/keypress/8278>\
**Category:** flash\
**Created:** [November 17, 2002, 12:59pm UTC](https://forum.kirupa.com/t/keypress/8278 "2002-11-17T12:59:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cannibal](https://avatars.discourse-cdn.com/v4/letter/c/2bfe46/32.png) [@cannibal](https://forum.kirupa.com/u/cannibal)\
**Post date:** [November 17, 2002, 12:59pm UTC](https://forum.kirupa.com/t/keypress/8278/1 "2002-11-17T12:59:32Z")

</div>

Hello all you flashers,

I realsie that this is a really dumb question, but I am trying to get the syntax correct for a KeyPress action.

Instead of on(keypress) do this or whatever. It would read something like hello\_btn. **onKeypress** = function() {  
gotoand stop and blah de blah. Except I cannot get the syntax right for the first line of code. I can do onRelease fine with this method but not keypress. Please help

Thanks in advance:rambo:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 17, 2002, 1:07pm UTC](https://forum.kirupa.com/t/keypress/8278/2 "2002-11-17T13:07:46Z")

</div>

This should work:

```php
Listener = new Object();
Listener.onKeyDown = function () { 
trace("success")
};
Key.addListener(Listener);

```

h88
