dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Mouse_out

  1. #1
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124

    Mouse_out

    I seem to have an issue where the mouse_out event is firing on a movieclip that the mouse is still over.

    Say I have mc1.

    mc1.addEventListener(MouseEvent.MOUSE_OVER, mOver);
    mc1.addEventListener(MouseEvent.MOUSE_OUT, mOut);

    function mOver(evt:MouseEvent):void {
    trace("blah");
    }
    function mOut(evt:MouseEvent):void {
    trace("blah out");
    }

    the mouse is on mc1, and the mouse_over event fires, then immediate the mouse_out event fires even when the mouse is still on mc1, Same happens when using roll_over and roll_out.

    Any ideas? Thanks.

  2. #2
    Senior Member
    Join Date
    May 2004
    Posts
    226
    Its because MOUSE_OVER/MOUSE_OUT events are bubbling up from all the displayObjects in mc1. Try using the use ROLL_OVER/ROLL_OUT events which do not bubble up the display chain.

  3. #3
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    I did, and still get the same result. Any other ideas? Thanks.

  4. #4
    Senior Member
    Join Date
    May 2004
    Posts
    226
    That's strange, ROLL_OVER/ROLL_OUT are not supposed to bubble.
    You could either set mc1.mouseChildren = false; if you don't need interactivity in mc1.
    or test the event target such as (untested):

    function mOver(evt:MouseEvent):void {
    if( InteractiveObject ( event.target ) != mc1 ) return;
    //do stuff here
    }

  5. #5
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    That's what I thought myself, really strange, but thanks, I'll give that a try.

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