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
Thanks!
I’m just getting started with Actionscript in Flash Builder and it’s these little bits that are there to trip me up!
Thanks again.
Comment by John R — March 26, 2011 @ 7:40 pm
Thanks much, just spent a few hours trying hair-brained schemes to do as you have done above very easily. Well done!
Comment by michael ray — November 17, 2011 @ 6:24 pm
Thanks Ryan. I’ve been working on making an interface for the images on my Photoshop page. The current one functions just fine, but updating it is a hassle because I have so many images to display. The event.target syntax is useful and your tutorial shows how to use it very well. Maybe you could provide some instruction on displaying an external image using this code for us? If not, much appreciation anyway for the instruction you have provided.
Comment by Chris — April 13, 2012 @ 7:49 pm