addEventListener function references child in movieclip. how do i stop this?
I built a custom designed checkBox. The movieclip is in the libary and dragged onto the timeline of my .swf. I'm using CS4 & AS3. I'm using procedural AS3 instead of OO AS3.
The checkbox movieclip has a child movieclip inside of it so I can apply a drop shadow filter to some of the graphics .
When I put an eventlistener on the custom checkbox it works fine but when I try to reference the checkbox movieclip inside the eventlistener function, the event.target.name is referring to the child movieclip (just a graphic with a drop shadow filter).
From my reading it looks like the function propogates down to the child movieclip but I don't want it to do that.
How do I
A. reference the parent movieclip?
or
B. stop the eventlistener from propogating down to the child movieclip?
I tried using stopPropagation(); but it didn't stop the function event.target.name from trickling down to the child movieclip.
Here's what AS3 looks like.
The trace statement displays "step3_mc.cbEmail_mc.instance25" instead of what I need "step3_mc.cbEmail_mc"
step3_mc.cbEmail_mc.addEventListener(MouseEvent.CLICK, fnc_cbClick);
step3_mc.cbAgree_mc.addEventListener(MouseEvent.CLICK, fnc_cbClick);
function fnc_cbClick(event:MouseEvent):void {
trace ("fnc_cbClick: " + event.target.name + " " + event.target.currentFrame );
if (event.target.currentFrame < 3 ) { event.target.gotoAndPlay("cbOn"); } else { event.target.gotoAndPlay("cbOff"); }
}