Monday, December 29, 2008 not working - as3 gotcha

So if you have ever encountered this :

head1.addEventListener(MouseEvent.CLICK, headClick);

private function headClick(e:MouseEvent):void {

// outputs something random like "instance22" instead of the instance name of the MC you are targeting, which in this case is "head1".

So after some searching and anger, (I still don't know why but this is only a random occurrence for me), if you add currentTarget in place of target

like so:

I get the proper results.
trace( // outputs "head1"; woohoo!

so if you keep seeing instance22, or instance286 instead of the instance name your looking for,. try the above.
if it still doesn't work, then something else is wrong,...