Affecting 100 buttons all at once

That’s what i need to do!
Switch on or off or trigger a gotoAndStop in 100 instances of the same button symbol by pressing a ‘reset’ button…
Is this even possible.?
At the moment I can only affect 1 button!!

thanks for help… sorry if it seems like a dumb question, but it’s friday and my head is going bongo-floyd!

thanks

marll

If the instances are all named like button1, button2, button3,…, button100, and your reset button is located in the same timeline as your buttons, you can use something like this:

resetbutton.onPress = function(){
for(var i=1; i<=100;++i){
this._parent["button"+i].gotoAndStop(frame);
}
}

i was rather hoping to find a solution where I wouldn’t have to rename all the buttons [ they currently all have the same name]
…but, if that works, then so be it!

thanks again Claudio. you are a real help as ever,

marll

Anytime marll :slight_smile:

i still don’t understand how you can be a ‘novice’!!!

:]

i find a very odd problem now!.. i need more than 100 buttons, in fact twice , maybe 3 x as may… i have named each button reveal1, reveal2 etc…
but now I have gotten past 100, flash does not see my buttons with any number higher… Any ideas how to get around this??

thanks
your puzzled friend

marll

resetbutton.onPress = function(){
        for(var i=1; i<=**300**;++i){
                this._parent["reveal"+i].gotoAndStop(frame);
        }
}

i am really sorry… i worked it out … call the cops off

WHOA hold on there claudio!

what the heck isthis?!

[AS]
this._parent[“reveal”+i].gotoAndStop(frame);
[/AS]

iam confused on why u path ur mcs like that

why add a this…and a _parent.??O_O I am stupid

and

btw, so by using [“reveal”+i] you can write multiple mc names like that?

so basically flash would see that as

_parent.reveal1.gotoAndStop(frame);
_parent.reveal2.gotoAndStop(frame);
_parent.reveal3.gotoAndStop(frame);
_parent.reveal4.gotoAndStop(frame);

am i right?

don’t worry aout the pathe name to much… i am not actually using that path, i use one to the mc which in this case is reveal_mc

btw, so by using [“reveal”+i] you can write multiple mc names like that?

so basically flash would see that as

_parent.reveal1.gotoAndStop(frame);
_parent.reveal2.gotoAndStop(frame);
_parent.reveal3.gotoAndStop(frame);
_parent.reveal4.gotoAndStop(frame);

am i right? **[/QUOTE]

Exactamundo! that is right…

mart

*Originally posted by Blenderben *
**WHOA hold on there claudio!

what the heck isthis?!

[AS]
this._parent[“reveal”+i].gotoAndStop(frame);
[/AS]**
That code is inside the onPress handler for the resetbutton. The scope right now is the resetbutton. If i want to reference something that is in the same timeline as the resetbutton, i need to go up one level in the movie hierarchy. Thats why i used this._parent. Im pointing to one level up from the current object.
Was that confusing? :pa: