# Dynamically placing new buttons

**URL:** <https://forum.kirupa.com/t/dynamically-placing-new-buttons/281940>\
**Category:** flash\
**Created:** [February 15, 2009, 7:52pm UTC](https://forum.kirupa.com/t/dynamically-placing-new-buttons/281940 "2009-02-15T19:52:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elbudster](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@Elbudster](https://forum.kirupa.com/u/Elbudster)\
**Post date:** [February 15, 2009, 7:52pm UTC](https://forum.kirupa.com/t/dynamically-placing-new-buttons/281940/1 "2009-02-15T19:52:32Z")

</div>

Hello,

It’s been a few years since I’ve last used ActionScript, so I’m a bit rusty 😛 Anyways, I have 16 buttons in my library with linkage names btn0-btn15. I can successfully add them onto the stage by saying something like:

```auto
var tempBtn:SimpleButton = new btn0();
stage.addChild(tempBtn);

```

I’m going to be tinkering with the buttons layout and positions, and I would like to add each of the different buttons to the stage dynamically with a for loop. I’ve been trying different variations of this:

```auto
for (int i:int=0; i<16; i++) {
    var tempBtn:SimpleButton = new ["btn" + i]();
}

```

but I just can’t seem to find the right syntax for doing this correctly. Any suggestions? 🙂
