1 Reply Latest reply on Jun 7, 2007 4:47 PM by Rothrock

    Capture mouse events off stage?

      I am trying to make a simple game where an object follows the mouse cursor. Problem is that as soon as the cursor exits the stage area the Flash cannot track the mouse position anymore.

      There are two behaviors I want to implement: One where objects always follow the mouse, and another where the cursor hits the edge of the stage and the stage pans. Both behaviors depend on detecting mouse location outside of the stage area.

      Does anyone have pointers (no pun intended) how to track the mouse outside of the stage area? Using Flash actionscript or maybe with Java? Or is there a way to get a fullscreen mode for flash so the cursor cannot exit the stage?

      I have searched the googletron for solutions in vain.

        • 1. Re: Capture mouse events off stage?
          Rothrock Level 5
          Flash 9 plugin does support full screen so that might be one solution.

          There is a Mouse_Leave event in AS3 that can tell you when the mouse leaves the area of your swf. You would then need to use externalinterface to communicate with some technology outside of flash such as javascript or such. I wouldn't know how to do it.

          Other than the full screen approach it all seems like a lot of trouble. Without knowing the exact specifics of what you are making can't you just have some kind of symbol that indicates the direction you are going and if they leave the stage area it either keeps going in the last direction or it returns to center until the mouse comes back?