Hi.
New at AS3, more of a designer than coder but I try.
I have 6 main buttons and 50 other buttons.
When people click on one of the six main buttons, I need the 50 other buttons labeled from t_1 to t_50 to be disabled (mouseEnabled=false).I should add that all 50 buttons are in a sub group:this.wholeTree.t_1
I don’t want to write the same line of code 50 times so I’m trying something like this. This is the code for button#6:
butt6.addEventListener(MouseEvent.CLICK,menu6Handler);
function menu6Handler(e:MouseEvent):void
{
if(this.menu6.currentFrame==15){
menu6.gotoAndPlay(16);
loader.load(new URLRequest("blank.swf"));
for (var i = 1; i < 51; i++)
{
this.wholeTree["t_" + i].mouseEnabled = true;
}
}else{
loader.load(new URLRequest("blank.swf"));
menu6.gotoAndPlay(2);
menu2.gotoAndStop(1);
menu1.gotoAndStop(1);
menu3.gotoAndStop(1);
menu4.gotoAndStop(1);
menu5.gotoAndStop(1);
for (var i = 1; i < 51; i++)
{
this.wholeTree["t_" + i].mouseEnabled = false;
}
}
}
This returns 2 errors:
The first one is warning 3596 Duplicate variable definition:
I tried assigning the variable definition just once at the beginning of the function but then it no longer works and the buttons 1 to 50 don’t get disabled.
The second error is TypeError: **Error #1010: A term is undefined and has no properties.**at main_Sustainability_fla::MainTimeline/menu6Handler()
Help…
Thanks.