# Key listener

**URL:** <https://forum.kirupa.com/t/key-listener/251645>\
**Category:** flash\
**Created:** [February 11, 2008, 1:13pm UTC](https://forum.kirupa.com/t/key-listener/251645 "2008-02-11T13:13:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![omoba12](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@omoba12](https://forum.kirupa.com/u/omoba12)\
**Post date:** [February 11, 2008, 1:13pm UTC](https://forum.kirupa.com/t/key-listener/251645/1 "2008-02-11T13:13:24Z")

</div>

My key listener is working fine but not as good as i want it. the program responds at every key press but I want about 2 seconds delay before program would respond to another key press.

AS

[COLOR=blue]listen = new Object();[/COLOR]  
[COLOR=blue]listen.onKeyDown = function() {[/COLOR]  
[COLOR=blue] if (key.isDown(key.getCode())) {[/COLOR]  
[COLOR=blue] nextFrame();[/COLOR]  
[COLOR=blue]}[/COLOR]  
[COLOR=blue]}[/COLOR]  
[COLOR=blue][/COLOR]  
[COLOR=blue]Key.addListener(listen)[/COLOR]
