# Key Detection

**URL:** <https://forum.kirupa.com/t/key-detection/208383>\
**Category:** flash\
**Created:** [November 28, 2006, 4:22am UTC](https://forum.kirupa.com/t/key-detection/208383 "2006-11-28T04:22:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Holmesc](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@Holmesc](https://forum.kirupa.com/u/Holmesc)\
**Post date:** [November 28, 2006, 4:22am UTC](https://forum.kirupa.com/t/key-detection/208383/1 "2006-11-28T04:22:58Z")

</div>

Hello! I am currently working on a vertical shooter game. All works well for now, except that I want to detect the key press F, but not with if(Key.isDown(70)). I would use that, but to get this thing to work, this thing being the playing of an animation, you really have to carefully tap the key. I want it to run more like on(keyPress “\<Space\>”), but I don’t know how to do that with the F key.  
Script:

```auto
onClipEvent (enterFrame) {
    if (Key.isDown(70)) {
        if (_root.gunOut == false) {
            this.gotoAndPlay("gun_out");
            _root.fire = true;
            _root.gunOut = true;
        } else if (_root.gunOut == true) {
            this.gotoAndPlay("gun_away");
            _root.gunOut = false;
            _root.fire = false;
        }
    }
}

```

Thanks for your help!

-={Holmesc}=-
