1 Reply Latest reply on Apr 11, 2009 5:33 PM by JeffryHouser

    flex not keeping variables values actual?

      It seems like mouseX and mouseY fields needs refreshment? Please, consider the code:

       

              public function onMouseDown(me:MouseEvent):void{

                     trace("down: ",mouseX,mouseY);
                     sprite.graphics.moveTo(mouseX, mouseY);
              }


              public function onMouseMove(me:MouseEvent):void{

                     trace("move: ",mouseX,mouseY);

                     sprite.graphics.lineTo(mouseX, mouseY);
               }

       

      If I do something like this: press down the mouse button, move a little (draw a short line), then release the button and press again (quickly, in different place) - the result is as if the mouseX and mouseY variables in onMouseDown function weren't actual. If I do it slowly - nothing wrong happens.  The trace output:

       

      down: 40,40 <- coordinates from onMouseDown

      move: 41,41

      move: 42,42

      move: 43,43

      move: 44,44

      down: 40,40 <- unrefreshed coordinates from onMouseDown

      move: 50,50 <- and then proper mouse coordinates

      move: 50,51

      move: 50,52

       

      MouseUp is handled. Does it make sense? Thanks for any help.