[mx] trying to count when all buttons have been clicked

I’m trying to create a loop of some kind. I haven’t done these before and I’ve tried searching the forum, but I’m still stuck. Not to mention, I still don’t understand the difference between a for, while, and do loop, but I will tackle those later.

For now I have several buttons that need to be clicked before the user can proceed. I am trying something like this:

on a mc I have the following:

onClipEvent (load) {
counter = 0;
}

onClipEvent (enterFrame){
if (counter >= 5) {
next_bttn.enabled = true;
}
}

on each button:

on (release) {
counter++;
}

Am I heading in the right direction?

um you would probably have to have a separate variable for each button…and when its clicked then the value is true…if it isn’t then the value is false. you could name these like button1, button2, etc…and then have a loop like


while(i<numberOfButtons){
if(button1=true){
do something
}

on the buttons you need to target the mc. The variable “counter” doesn’t exist on the same timeline as the buttons.

just add the movieclip’s name to the counter call, i.e.

 on (release){
_root.myMovieClip.counter ++;
}

I think that’s right.