# Affecting 100 buttons all at once

**URL:** https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295
**Category:** flash
**Created:** [March 12, 2004, 8:13pm UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295 "2004-03-12T20:13:56Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![MArll](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@MArll](https://forum.kirupa.com/u/MArll)
#### Post date: [March 12, 2004, 8:13pm UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/1 "2004-03-12T20:13:56Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 12, 2004, 8:19pm UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/2 "2004-03-12T20:19:14Z")

</div>

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:

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

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 13, 2004, 1:51am UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/3 "2004-03-13T01:51:51Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 13, 2004, 1:53am UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/4 "2004-03-13T01:53:31Z")

</div>

Anytime marll 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 13, 2004, 2:02am UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/5 "2004-03-13T02:02:31Z")

</div>

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

:]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 13, 2004, 3:01am UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/6 "2004-03-13T03:01:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 13, 2004, 3:05am UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/7 "2004-03-13T03:05:35Z")

</div>

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

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 13, 2004, 3:05am UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/8 "2004-03-13T03:05:43Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 13, 2004, 8:00pm UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/9 "2004-03-13T20:00:54Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 13, 2004, 8:44pm UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/10 "2004-03-13T20:44:57Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 13, 2004, 10:19pm UTC](https://forum.kirupa.com/t/affecting-100-buttons-all-at-once/45295/11 "2004-03-13T22:19:00Z")

</div>

> \*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:
