Problem:
You’ve added a listener to a movieclip, but the target returned is another movieclip or sprite within that movieclip.
Solution:
myMovieclip.mouseChildren = false;
Yeah, that’s all. Now the movieclip you added the listener to will be the only thing returned as the target of an event. If you want a little more proof before you go through all the trouble to add that line of code, then check my example below:
This movie requires Flash Player 9
Here’s the code (on the timeline):
blockLeft.addEventListener(MouseEvent.CLICK, clickBlock); blockLeft.buttonMode = true; blockLeft.mouseChildren = true; blockRight.addEventListener(MouseEvent.CLICK, clickBlock); blockRight.buttonMode = true; blockRight.mouseChildren = false; function clickBlock(e:Event):void { txtTarget.text = "e.target.name: " + e.target.name; }

Wow thank you so much I was having so much trouble with this.
Comment by Varkson — July 10, 2010 @ 9:22 am