Hi,
I am adding some movieclips dynamically to stage. If we click on the movieclips, they goto and stop at frame 2. The Click Event for the Movieclip is defined in the base class
package {
import flash.events.MouseEvent;
import flash.display.MovieClip;
public class Box extends MovieClip {
public var _mcName:*
public function Box() {
this.addEventListener(MouseEvent.CLICK, getMcName)
}
private function getMcName(e:MouseEvent):void{
e.target.gotoAndStop(2);
_mcName=e.target.name;
}
}
}
Flash code
var box:box_mc = new box_mc;
var box2:box_mc = new box_mc;
var box3:box_mc = new box_mc;
addChild(box)
addChild(box2)
addChild(box3)
box2.x=100;
box3.x=200;
I want to get the Movieclip name when users click on them. Say, I would like to delete the selected movieclip.
But, I cannot figure out how to get the name of the movieclip.
I cannot add click event for movieclips in flash, because there is already a click event in the class file.
How can I get the mc instance name?
Please help me with this.
Thanks