Actionscript 3: Detect hidden movieclip on stage overlapping buttons

If  you run into issues with an invisible display object covering your button but you don’t know where it is, this handy code snippet I got from my co worker Kris can trace it out for you.

Just drop it in your constructor.

stage.addEventListener(MouseEvent.CLICK,_checkMouseEventTrail,false,0,true);
function _checkMouseEventTrail($e:MouseEvent):void
{
var p:* = $e.target;
while(p)
{
trace(">>", p.name,": ",p);
p = p.parent;
}
};

Author: mark

Creative technologist

Leave a Reply

Your email address will not be published. Required fields are marked *