# Displaying a for loop in two columns

**URL:** <https://forum.kirupa.com/t/displaying-a-for-loop-in-two-columns/319108>\
**Category:** Uncategorized\
**Created:** [February 9, 2011, 4:33am UTC](https://forum.kirupa.com/t/displaying-a-for-loop-in-two-columns/319108 "2011-02-09T04:33:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icekomo](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@icekomo](https://forum.kirupa.com/u/icekomo)\
**Post date:** [February 9, 2011, 4:33am UTC](https://forum.kirupa.com/t/displaying-a-for-loop-in-two-columns/319108/1 "2011-02-09T04:33:50Z")

</div>

I am trying to create a menu using a for loop. I got the loop working at the data to display, but after the 3rd button I want to put the other 3 buttons to the right of the first three, if that makes sense.

Right now the first 3 displays, and the last 3 are moved over where they need to be, but it’s still below the 3rd one, how do I get the 4th item to line up with the 1st time on the x axis?

Here is that code I am using.

var mc:MovieClip;  
var yCount:Number = 0;

for (var i:int=0; i\<navigation.length; i++)  
{  
mc = new menuButton ;  
var yCord:Number = 0;  
mc.labelText.text = navigation\*.name;  
[//mc.y](https://mc.y) = i \* 20;  
mc.buttonMode = true;

```
yCount++;
if (yCount &lt; 4)
{
	mc.y = i * 20;
	trace("y count");
}
else
{
	mc.y = 0 + i * 20;
	mc.x = mc.width + 1;
}
menu.menuHolder.addChild(mc);
navigation* = mc;

```

}  
Thanks for all the help!
