I’m trying to use an array to add a click listener to an existing Button.
Black,Blue…etc are the button Names.
the location of the nested button would be:
this.mc1.mc2.contents.m3.black.addEventListener(MouseEvent.CLICK, doThisFunction);
var myArray:Array = new Array ("black","blue","green","orange");
for(var k:int =1; k<myArray.length; k++){
var kmc:MovieClip = (myArray[k] as MovieClip);
this.mc1.mc2.contents.m3.kmc.addEventListener(MouseEvent.CLICK, doThisFunction);
}
Any help would be greatly appreciated!
First
kmcis a String:Then the last line should be: