# Call all buttons? AS2

**URL:** <https://forum.kirupa.com/t/call-all-buttons-as2/260986>\
**Category:** Uncategorized\
**Created:** [May 21, 2008, 7:12pm UTC](https://forum.kirupa.com/t/call-all-buttons-as2/260986 "2008-05-21T19:12:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![newsteve](https://avatars.discourse-cdn.com/v4/letter/n/5f8ce5/32.png) [@newsteve](https://forum.kirupa.com/u/newsteve)\
**Post date:** [May 21, 2008, 7:12pm UTC](https://forum.kirupa.com/t/call-all-buttons-as2/260986/1 "2008-05-21T19:12:10Z")

</div>

hi,

how can i call all buttons within a certain movieclip (without naming each instance individually)?

Im looking for the actionscript.

Thanks!

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [May 22, 2008, 9:13am UTC](https://forum.kirupa.com/t/call-all-buttons-as2/260986/2 "2008-05-22T09:13:10Z")

</div>

for loop

with each button called but1, but2 etc

standard

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [May 23, 2008, 1:19am UTC](https://forum.kirupa.com/t/call-all-buttons-as2/260986/3 "2008-05-23T01:19:55Z")

</div>

```auto
for(var i in myMovieClip) {
var thisMovie:Object = myMovieClip*;
if (typeOf(thisMovie) === "movieclip") {
trace(thisMovie);
}
}

```

---

<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:** [May 23, 2008, 1:50pm UTC](https://forum.kirupa.com/t/call-all-buttons-as2/260986/4 "2008-05-23T13:50:48Z")

</div>

this is great, I’ve had this doubt before and this aims at it.

there’s something else I’d like to ask, though. I know it might sound kinda stupid, but what the heck.

suppose you’ve got several buttons in a movieclip, each one with its set of instructions, whatever. (I’m going for buttons, but I think this could apply for any sort of object, really)  
each button’s got a prefix of some sort and then its specific name, say ‘buttonHere\_btn’, ‘buttonThere\_btn’, ‘buttonEverywhere\_btn’.  
all I want is to change the specific bit in each buttons’ designation…

could this be done with an array holding the specific names for each button, that is [“Here”, “There”, “Everywhere”] and then loop across this array? how do I name each button then? I’m looking for the syntax, 'cause I’ve been trying this and it always messes up…

thanks!

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [May 23, 2008, 2:11pm UTC](https://forum.kirupa.com/t/call-all-buttons-as2/260986/5 "2008-05-23T14:11:52Z")

</div>

that is possible but incrementing with numbers is the standard

for example xml

this.firstchild.ChildNodes[0] = title 0 = "here"  
this.firstchild.ChildNodes[1] = title 1 = "there"  
etc

also you should use movieclips as buttons,
