I've a row of MovieClips with开发者_C百科 the instance names holder0 to holder7. How can I get the holder name of the MovieClip by click?
Thanks for tips.
Something like this:
var mc:MovieClip;
for (var i:int = 0; i<8; i++) {
mc = this["holder"+i];
mc.buttonMode = true;
mc.mouseChildren = false;
mc.addEventListener(MouseEvent.CLICK, clickHandler);
}
function clickHandler(e:MouseEvent):void {
trace(e.target.name);
}
精彩评论