# On(release) firing when holding a key?

**URL:** <https://forum.kirupa.com/t/on-release-firing-when-holding-a-key/187112>\
**Category:** Uncategorized\
**Created:** [April 26, 2006, 6:53pm UTC](https://forum.kirupa.com/t/on-release-firing-when-holding-a-key/187112 "2006-04-26T18:53:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FizixMan](https://avatars.discourse-cdn.com/v4/letter/f/e9c0ed/32.png) [@FizixMan](https://forum.kirupa.com/u/FizixMan)\
**Post date:** [April 26, 2006, 6:53pm UTC](https://forum.kirupa.com/t/on-release-firing-when-holding-a-key/187112/1 "2006-04-26T18:53:20Z")

</div>

I’m working on a ACAD flash system, and one of the functions is to draw lines. Now I’d like to be able to draw vertical/horizontal lines by holding a key down (i.e. Shift). But I’m finding that the system is detecting me releasing the mouse (I’m not) while I hold another key.

Attached is a .fla file where you can click and drag a box.

Don’t worry about posting “oh you should use startDrag()” and whatnot. The architecture of the actual application makes such things not feasible. This is just a test .fla.

The code is here:  
ActionScript Code:  
[FONT=Courier New][LEFT][COLOR=#0000FF]on[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onMouseMove[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]‘Mouse is moving’[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]\_x[/COLOR] = [COLOR=#0000FF]\_root[/COLOR].[COLOR=#0000FF]\_xmouse[/COLOR];  
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]\_y[/COLOR] = [COLOR=#0000FF]\_root[/COLOR].[COLOR=#0000FF]\_ymouse[/COLOR];  
[COLOR=#000000]}[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#0000FF]on[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onMouseMove[/COLOR] = [COLOR=#000000] **null** [/COLOR];  
[COLOR=#0000FF]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“Mouse released”[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#0000FF]on[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onMouseMove[/COLOR] = [COLOR=#000000] **null** [/COLOR];  
[COLOR=#0000FF]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“Mouse released”[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]

So yeah, as you run it and drag the object around, you see a lot of “Mouse is moving”, but if you press and hold any key, you’ll also notice the “Mouse released” as well.

Thoughts?
