# Double press?

**URL:** <https://forum.kirupa.com/t/double-press/202491>\
**Category:** Uncategorized\
**Created:** [October 2, 2006, 3:36am UTC](https://forum.kirupa.com/t/double-press/202491 "2006-10-02T03:36:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kpxnamja](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@kpxnamja](https://forum.kirupa.com/u/kpxnamja)\
**Post date:** [October 2, 2006, 3:36am UTC](https://forum.kirupa.com/t/double-press/202491/1 "2006-10-02T03:36:11Z")

</div>

I’ve come to a stumbling point.  
How do you have flash recognize a **double** pressed key from a **single** press?  
Similar to a double click on a window program opening the software, and a single click selecting the program. How would you program flash to do a similar **detection**?

For instance, if I have a MC named “hero” and I want it to move casually with these simple movement scripts:

```php

_root.hero.onEnterFrame = function() {
if (Key.isDown(87)){
        movement = "up"; 
        this._y -= _root.speed;
    }
    if (Key.isDown(83)){
        movement = "down";
        this._y += _root.speed;
    }
    if (Key.isDown(65)){
        movement = "left";
        this._x -= _root.speed;
    }
    if (Key.isDown(68)){
        movement = "right";
        this._x += _root.speed;
    }
}

```

However, if the “up” (87) is double pressed I want it to move double times the speed for a short second.

Is there any suggestions for this function?
