Making a for-loop with Button Variable


I have a small problem and I hope you know if this is possible.

The situation is like this:
I have Five buttons named button1 to Button5.
What I want is to make one button invisible.
To to this I have a for 1 to 5 -loop and I want to make one button invisible if it meets certain criteria.

Is this possible without make an if-line for each button or not??

I hope One of You can help me, Thanx in advance.



//event happens to make one of the buttons disappear (button press, frame entry, whatever...)

buttonNum = 5;

for(i = 1; i<=buttonNum; i++)
   if(button* condition) {
      button*._visible = false;


I have tried this but the button stays visible.

I have tried names like Button1 or Button[1] but both don’t respond.
If I try it with both named Button1 then the button is indeed invisible.

Is there an other place to enter a name or did I do it wrong??

Thanks in advance.

Hey Karen, what is button* supposed to be? An element of an array?

pom :asian:

And I’m repeating: I love your footer, it’s brilliant!


button* =;

I have to watch my, um, “illustrative” posts. The code will work if the buttons are nested in numbered movie clips (i.e. buttonMC1, buttonMC2, etc.) and targeted properly (i.e. not like my gibberish code above) in the loop.

My apologies. I will try to think-then-speak from now on. :slight_smile:


PS… Thanks again on the footer! It’s so cool you noticed it.