hey,
i have a movieclip called allBUTTONS which contains 18 buttons. This movieclip will be called numerous time on the CDROM I am creating, and each time the number of buttons visible will change.
So instead of writing the following code numerous times for however many buttons i want visible:
Code:
_root.allBUTTONS.button01._visible = true;
_root.allBUTTONS.button02._visible = true;
_root.allBUTTONS.button03._visible = true;
_root.allBUTTONS.button03._visible = false;
....I have written the following code:
Code:
var buttonNumber:Number = 0;
for (var i:Number = 0; i < 6; i++) {
buttonNumber++;
_global.buttonName = "button0"+buttonNumber;
trace(buttonName);
}
and this works fine and traces the following:
button01
button02
button03
button04
button05
button06
now i thought that i could add the follwing line into the loop:
_root.allBUTTONS.buttonName._visible = false;
so I have:
Code:
var buttonNumber:Number = 0;
for (var i:Number = 0; i < 6; i++) {
buttonNumber++;
_global.buttonName = "button0"+buttonNumber;
_root.allBUTTONS.buttonName._visible = false;
trace(buttonName);
}
so each time the loop occurs it would turn buttons 1 - 6 invisible. It doesn't work though. Is the syntax wrong? Am I adding the 'buttonName' variable into the line of code in the wrong manner?
Any help would be greatly appreciated!
Cheers,
James