0
votes

So I'm working on a button that plays a sound when clicked or 'mousedown' on, and stops playing when releasing the mousebutton. The mouseup event is set on the stage object.

So the issue is when the cursor is dragged outside the flash movie and then released, the sound doesn't stop since the onmouseup doesn't register anymore. Thus is there a way to detect either mouseup events, or mouse coordinates outside the stage/flash object itself with actionscript?

1

1 Answers

0
votes

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Stage.html#event:mouseLeave

Add an Event.MOUSE_LEAVE listener to the Stage. This event fires in 2 ways:

  • Mouse button is already released and leaves the Stage
  • Mouse button is down and leaves the Stage, then mouse button is released

If your mouse button is down and you leave the Stage, it doesn't fire. An example reason is this: You start dragging a MovieClip and you go off Stage, when you come back to the Stage naturally you expect to still be dragging.