# Help with displaying array in two columns

**URL:** <https://forum.kirupa.com/t/help-with-displaying-array-in-two-columns/320619>\
**Category:** Uncategorized\
**Created:** [March 28, 2011, 7:57pm UTC](https://forum.kirupa.com/t/help-with-displaying-array-in-two-columns/320619 "2011-03-28T19:57:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![invisible7](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@invisible7](https://forum.kirupa.com/u/invisible7)\
**Post date:** [March 28, 2011, 7:57pm UTC](https://forum.kirupa.com/t/help-with-displaying-array-in-two-columns/320619/1 "2011-03-28T19:57:18Z")

</div>

i have an array that generates a list of buttons. What i would like to do is split the list into two columns of 5 buttons each rather than one column of 10 buttons.

I thought of creating two arrays of 5 items each, but couldn’t figure out how to assign my dynamic button to the second array or set a second x/y position for the new column.

any help greatly appreciated.

```auto
	public class Actions extends MovieClip {
private var off:Object;
		
public function Actions () {
addButtons();	
}
private function addButtons():void {
var names:Array = new Array("1","2","3","4","5","6","7","8","9","10" );

for (var i:int = 0; i < names.length; i++) {
		
var myButton:MyButton = new MyButton();
myButton.txt.tf.text = names*;
myButton.name = "b" + i;
myButton.buttonMode = true;
myButton.mouseChildren = false;
myButton.addEventListener(MouseEvent.ROLL_OUT, bOut);
myButton.addEventListener(MouseEvent.ROLL_OVER, bOver);
myButton.addEventListener(MouseEvent.CLICK, bClick);
myButton.x = 50;
myButton.y = 10 + (myButton.height * i);
addChild(myButton);
			
}
}

```
