1 Reply Latest reply on Jun 5, 2007 3:37 PM by Twinsen2007

    Actionscript 3 / Firefox / Mouse release outside stage

    Twinsen2007
      So I need to be able to detect when the user releases the mouse button outside the stage/movie bounds. I am using Actionscript 3 / Flash 9.

      Since onReleaseOutside was nixed, and setCapture is no longer there now that Flash 9 is final, I'm using an event listener for mouse_up on the stage. This works sometimes... but specifically not when running inside Firefox 2.0 on a Mac..or when wmode is set to something non standard (opaque or transparent running on Windows/Firefox).

      This is quite critical actually, pretty easy to repro, assuming you have Firefox and MAC. Just drag a slider component onto your stage inside a test app. Publish, then run inside the browser. If you drag the slider, mouse outside the movie bounds, then release..then mouse back over movie, the slider continues to animate - thinking you still have the mouse pressed.

      I've also tried inspecting the buttonDown property of the mouse move event..but once you've released outside the bounds of the movie - it's always true.

      More info at http://www.justsuppose.com

      I'm grasping for straws..anyone stumble across a workaround???

      Thanks,

      Corey
        • 1. Actionscript 3 / Firefox / Mouse release outside stage
          Twinsen2007 Level 1
          UPDATE: Stumbled upon a workaround after much trial and error. At least until they fix mouse_up.

          So considering the mouseLeave event... This event is dispatched usually as soon as your cursor leaves the bounds of the player window. But... if you've moused down first, then dragged outside window, the mouseLeave is not fired *until* Flash is done tracking. In other words, until the user lets go of the mouse button.

          So now I listen for *both* mouse up and mouseLeave on the stage object and I can reliably (cross browser), detect when the user has released the mouse button in the case the cursor is outside of the stage. In this scenario I only attach the mouseLeave and mouseUp listeners on the stage after the user has first moused down. I then remove them once I've detected the mouse up.

          Still hoping for a fix, but at least this provides an alternative (albeit sneaky) work around.