Posted By

curiousmedia on 10/15/09


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


What am I REALLY clicking on!?

 / Published in: ActionScript 3

Will trace the name of the display object that is actually receiving mouse events. Useful when the target of your mouse event is not what you are expecting. Oh, the fix 80% of the time is mouseChildren = false;

  1. addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{trace(" : ";});

Report this snippet  


RSS Icon Subscribe to comments
Posted By: curiousmedia on October 16, 2009

aw, c'mon - no code in comments? seriously?

Posted By: curiousmedia on October 16, 2009

function IDselfOnClick(e:MouseEvent):void
    trace("you clicked on ["+e.currentTarget+"] ";
function makeEverythingIDselfOnClick(target:DisplayObjectContainer):void
    trace("target = " +
    for(var i:int=0; i<target.numChildren; i++)
        var child = target.getChildAt(i);
        if( (child is InteractiveObject) )
            InteractiveObject(child).addEventListener(MouseEvent.CLICK,IDselfOnClick, false, 0, true);
        if( (child is DisplayObjectContainer)&&(child != target) )
Posted By: curiousmedia on October 16, 2009

there we go!

Posted By: knalle on October 19, 2009

(oh, i guess I'm just elaborating on thing already posted)

You need to login to post a comment.