A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: !hitTest...creating the opposite of a hitTest

  1. #1
    Senior Member
    Join Date
    Jun 2007
    Posts
    204

    !hitTest...creating the opposite of a hitTest

    When I roll over a mc an enter frame triggers a function that is designed to evaluate when the mouse moves off the mc...how do you test for the opposite of a hitTest? I though in an "!", but didn't work.

    PHP Code:

    var buttonTarget:String "targetMarkets_mc";

    root[buttonTarget].addEventListener(MouseEvent.MOUSE_OVERoverHandler);

    function 
    overHandler (event:MouseEvent){
                
        
    root[buttonTarget].gotoAndStop ("active");
        
        
    root[buttonTarget].addEventListener(MouseEvent.MOUSE_MOVEmouseEval);
    };

    function 
    mouseEval (event:MouseEvent) {
        
        if (!
    root[buttonTarget].hitTestPoint (mouseXmouseYtrue)) {
            
    root[buttonTarget].gotoAndStop ("inactive");
            
    root[targetMC].removeEventListener (MouseEvent.MOUSE_MOVEmouseEval);
        }
    }; 
    Also, how do you remove the event listener? Is there a need?

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Why not just use ROLL_OVER instead? And always clean up your event listeners:

    PHP Code:
    e.target.removeEventListener(e.typearguments.callee); 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center