# onRelease happens when key is pressed?

**URL:** <https://forum.kirupa.com/t/onrelease-happens-when-key-is-pressed/256339>\
**Category:** flash\
**Created:** [April 2, 2008, 5:38am UTC](https://forum.kirupa.com/t/onrelease-happens-when-key-is-pressed/256339 "2008-04-02T05:38:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben2](https://avatars.discourse-cdn.com/v4/letter/b/a8b319/32.png) [@Ben2](https://forum.kirupa.com/u/Ben2)\
**Post date:** [April 2, 2008, 5:38am UTC](https://forum.kirupa.com/t/onrelease-happens-when-key-is-pressed/256339/1 "2008-04-02T05:38:08Z")

</div>

I’m writing a program that has a button, and when pressed, and the shift key is pressed, will do an action. I have an onRelease function for that button also, but for some reason when I have the button pressed, and I press shift or any other key, it automatically thinks the button is being released. I was using the onMouseDown, onMouseUp functions before, but they caused me a lot of problems aswell.

Try it for yourself:

```auto
btn.onPress = function() {
trace("pressed"); //now hit a keyboard button
}
btn.onRelease = function() {
trace("released..or did you?");
}

```

Thanks, if anyone can help me.  
Ben.
