Hello, everyone. I am aware that the stage will not dispatch a MOUSE_LEAVE event when the mouse button is down. However, when the mouse button is down the mouseX and mouseY properties still increase and decrease when the mouse moves outside the stage, so one can detect if the mouse has left the stage by looking at the mouseX and mouseY properties. All is well.
However, this works slightly differently when I test in Internet Explorer rather than Flash. Sometimes when the mouse leaves the stage with the mouse button down not only will the MOUSE_LEAVE event not be dispatched but the mouseX and mouseY properties will stop changing as well. This only happens when the mouse button is pressed down over a blank area of the stage or a shape, not a movieclip, and even then only when the mouse hasn’t passed over a movieclip in a certain direction. I presume this has something to do with InteractiveObjects and MouseEvents but the stage is an InteractiveObject so this is hard to make sense of. Anyway, how do I detect if the mouse has left the stage in such a situation?
I realize that simply obscuring the stage entirely by a movieclip with a large solid colored rectangle in it would fix the problem, and is probably good practice besides, but I’d like to know if there’s another way. Part of my goal is to make sure dragged objects don’t continue to get dragged when the mouse button is released outside the stage.
You can test this file in Flash and then publish as HTML to see what I’m talking about. The text “up” appears when the stage fires MOUSE_UP events and “leave” for MOUSE_LEAVE events. The gray area is occupied by a movieclip and the white area is just the blank stage.