2 Replies Latest reply on Jun 1, 2010 1:26 AM by Dajji

    Mashing hitTestPoint, localToGlobal, the mouse position and a component ...

    jp77 Level 1

      It's late on friday and the mind is most likely already shutting down, but I can't seem to figure out (if it is indeed possible) how to match the above terms together ---

       

      Basically I have a ui component (canvas in a viewstack) that does a 3d flip effect to the next canvas in the viewstack when the mouse rolls over it and then a 3d flip out effect when the mouse rolls out. It works fine if you do it all slowly .... as soon as you roll out during the effect the roll out event is not triggered and the component stays in the rolled over view until you roll over again and roll out slowly.

       

      So what I was thinking was to attach an effect complete event to the flip effect, which would in turn run a quick check to see if my mouse pointer was still over the canvas (true) or the user had indeed already rolled out during the effect (false), in which case I would trigger the roll out effect.

       

      here is some of the code I am mashing around with, I know it must be a mix of the below, but what is the right mix .....

       

      private function checkIfMouseOver(event:EffectEvent):void
        {
         var globalPoint:Point = localToGlobal(new Point(canvasOverState.x,canvasOverState.y));
         trace(canvasOverState.hitTestPoint(globalPoint.x, globalPoint.y, true));

       

      //where to add in the mouseX and mouseY values to compare to??
        
        }

       

      Thanks in advance,

       

      JP