2 Replies Latest reply on May 29, 2009 6:06 AM by kglad

    Stage mouse leave

    Venian Level 2

      Hi there.

       

      Is there a way in ActionScript 2 to know when the mouse leaves the stage? So that I know when the mouse is in the flash movie and when it doesnt (like when the mouse is in the browser on the html page)?

       

      Thanks.

        • 1. Re: Stage mouse leave
          Venian Level 2

          Found a solution:

           

          var mX:Number = new Number(_xmouse);

          var mY:Number = new Number(_ymouse);

           

          var n:Number = setInterval(CheckMouseMove, 200);

          function CheckMouseMove() {

          if (mX == _xmouse or mY == _ymouse) {

          trace("Mouse Stop");

          }

          mX = _xmouse;

          mY = _ymouse;

          };

           

          It works best with an interval. With MouseMove or EnterFrame is not accurate.

          • 2. Re: Stage mouse leave
            kglad Adobe Community Professional & MVP

            that looks like it checks if the mouse is moving or not.  it doesn't check if the mouse leaves the stage.