views:

27

answers:

2

is it possible for flash to detect off-stage mouse coordinates in order to continuously drag an object within its bounds while the mouse is moving outside of the stage?

for example: i have a draggable red square on my stage. the stage is the bounds of the drag. if i drag the red square to the bottom of the stage and continue to drag outside of and around the stage, i'd like the red square to continue moving within it's bounds, following the mouse coordinates.

currently, dragging halts as soon as i leave the stage and the red square only begins to move with the mouse coordinates if i reenter the stage bounds.

A: 

Flash won't get mouse events when the mouse is out side its stage area; so I'm afraid you can't do this.

Amarghosh
really? i mean. since my red square is bound within the stage, if while dragging (mouse held down) i move out of the stage, the red box just stops at the edge. however, if i move my mouse down while still dragging and out of the stage, releasing the mouse will shift the red square to the closest mouse coordinates out side of the stage. so it's able to read the coordinate off stage when dropped.
TheDarkInI1978
@TDI That could be because `stage` fires one `mouseMove` (and one `mouseLeave`) event when you leave the mouse.
Amarghosh
A: 

If the flash piece is inside a web browser, you "could" try and use javascript to gather the x and y position for Mouse and then feed it back to Flash using ExternalInterface. A word of caution though, this could turn out to be very hard to integrate into all browsers and there is a lot of room for errors. This shouldn't stop you from trying though.

stickupkid