Take the 2-minute tour ×

In Flash, there seem to be two sets of mouse click events:

  • onMouseUp, onMouseDown
  • onPress, onRelease

Is there any actual difference between these events? I can't tell from the documentation, and I haven't noticed anything in actual usage, but it seems odd to have two different sets of names for the same basic events. Am I missing something? Is there a difference between them?

Clarification: This is in ActionScript 2 code, targeted at Flash 8.

share|improve this question

5 Answers 5

up vote 5 down vote accepted

onMouseDown and onMouseUp are general events that anything can listen to via Mouse.addListener(). They get triggered no matter where the mouse is clicked.

onPress and onRelease are specific to a particular MovieClip. They only get triggered if the mouse is pressed or released while on top of that MovieClip. Also important is onReleaseOutside...for the case where you click down on a MovieClip, then drag the mouse outside, then release the mouse. In that case there will be no onRelease event, only an onReleaseOutside event, so if you're not listening to the latter, your program will think the mouse button got stuck.

share|improve this answer
It's weird that the movie clips have an onMouseUp and onMouseDown though. That implies that they're specific to that clip, but it turns out they aren't. –  Herms Oct 13 '08 at 16:01
You're right about Press/Release being tied to a MC, but the real difference is that these are contextually different events. That is, you can have a Press that's not a MouseDown, or a MouseDown that's not a Press. See my answer below. –  fenomas Oct 14 '08 at 2:04

Press/Release are interaction events, not mouse events. If you activate a button or MC with the keyboard (by tabbing to it and pressing space), it will fire a Press event but not a MouseDown. Likewise, if you click on a disabled button, that will fire a MouseDown event but not a Press (since no button interaction occurs).

share|improve this answer

Not a flash developer, but in normal windows apps you can press a button with the spacebar, and activate it via the enter key.

Also, a MouseUp/Down can happen anywhere and may not imply anything. A Press/Release on a specific control therefore has more significance.

share|improve this answer
All these event handlers are going on a specific UI object, so I think they'd still be meaningful. Just as meaningful as Press/Release at least. –  Herms Oct 13 '08 at 15:25
In this case, perhaps yes. The point was that a MouseUp/Down doesn't have to be meaningful, while a Press/Release probably does. The first part of my post still answers the question. –  Joel Coehoorn Oct 13 '08 at 15:46
I'm not sure the first part is relevant. I'm not talking about buttons here, just random movie clips (canvases) in the SWF. –  Herms Oct 13 '08 at 15:51
Absolutely this answer is relevant. Random movie clips can be "pressed" by tabbing to them and pressing the space bar, just like buttons can. –  fenomas Oct 14 '08 at 2:07

I found this while doing some googling of the question:


It looks like the mouseUp/mouseDown events will trigger even when the mouse is outside the movie clip, while onPress/Release will automatically check to see if the mouse is within the clip before being handled. I could have sworn I tested for that, but I just verified it, so I must not have.

share|improve this answer

onPress and onRelease are hold overs from AS2 code, they have been supplanted by onMouseDown and onMouseUp in AS3, which you can read about in the AS2 Migration Guide.

share|improve this answer
I'm working in AS2 code, not AS3. I added a clarification to the question. Sorry, I thought I had mentioned that initially, but I guess I forgot. –  Herms Oct 13 '08 at 15:52

Your Answer


