# Arranging dynamic buttons on stage

**URL:** <https://forum.kirupa.com/t/arranging-dynamic-buttons-on-stage/48623>\
**Category:** flash\
**Created:** [April 15, 2004, 5:22am UTC](https://forum.kirupa.com/t/arranging-dynamic-buttons-on-stage/48623 "2004-04-15T05:22:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skaiwayne](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@skaiwayne](https://forum.kirupa.com/u/skaiwayne)\
**Post date:** [April 15, 2004, 5:22am UTC](https://forum.kirupa.com/t/arranging-dynamic-buttons-on-stage/48623/1 "2004-04-15T05:22:46Z")

</div>

I’m creating buttons dynamically depending on the number I get from a file. So far I can align the buttons either straight up and down having 1 per row or all across. I want to be able to add as many as I want per row. Here is the code Im using.

```auto

buttonNames = fmenuitems.split(",");
buttonHeight = 40;
//trace(fmenuitems)
i = 0;
while (i < menutxtcount) {
	
//	trace(buttonNames*)
	this.attachMovie("button", ("button" + i), i);
//	trace(i)
	this[("button" + i)]._x = 0;
this[("button" + i)]._y = i * buttonHeight + buttonWidth;

	this[("button" + i)].text = buttonNames*;
	this[("button" + i)].frame = i + 46;
//	trace(this[("button" + i)].frame = i + 45)
	
	i++;
}
stop();

```
