# Waiting 1/8th second to detect onKeyDown

**URL:** <https://forum.kirupa.com/t/waiting-1-8th-second-to-detect-onkeydown/191137>\
**Category:** flash\
**Created:** [June 17, 2006, 6:04pm UTC](https://forum.kirupa.com/t/waiting-1-8th-second-to-detect-onkeydown/191137 "2006-06-17T18:04:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rustyd](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@Rustyd](https://forum.kirupa.com/u/Rustyd)\
**Post date:** [June 17, 2006, 6:04pm UTC](https://forum.kirupa.com/t/waiting-1-8th-second-to-detect-onkeydown/191137/1 "2006-06-17T18:04:17Z")

</div>

Rock Paper Scissors game - again (but soooo close).

How would one go about telling Flash “Hey, if the User does NOT hit the left down or right key within 1/8th of a second then…do something”?

Here’s my AS which works and displays a Rock, Paper or Scissors depending on the arrow key pressed, I just need some way to “time out” if they don’t press a key quick enough.

```auto
 
var keyListener_obj:Object = new Object();
keyListener_obj.onKeyDown = function() {
    switch (Key.getCode()) {
     case Key.LEFT :
      RPSUser_mc.getNextHighestDepth();
      RPSUser_mc.gotoAndStop(2);
     break;
     case Key.DOWN :
      RPSUser_mc.getNextHighestDepth();
      RPSUser_mc.gotoAndStop(3);
     break;
     case Key.RIGHT :
      RPSUser_mc.getNextHighestDepth();
      RPSUser_mc.gotoAndStop(4);
     break;
     }
};
Key.addListener(keyListener_obj);

```

I have no clue what I would need to search for to do this.
