# Making a Multiple Row Menu with Arrays

**URL:** <https://forum.kirupa.com/t/making-a-multiple-row-menu-with-arrays/239079>\
**Category:** Uncategorized\
**Created:** [September 18, 2007, 4:02pm UTC](https://forum.kirupa.com/t/making-a-multiple-row-menu-with-arrays/239079 "2007-09-18T16:02:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrmike](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@mrmike](https://forum.kirupa.com/u/mrmike)\
**Post date:** [September 18, 2007, 4:02pm UTC](https://forum.kirupa.com/t/making-a-multiple-row-menu-with-arrays/239079/1 "2007-09-18T16:02:27Z")

</div>

Hi guys,

I’m trying to make a navigation of sorts using a bunch of thumbnails there will be 3 columns and 3 rows.

I have made an array of images, created a button with an empty movie clip in it. And I am attempting to make a 3 by 3 grid of buttons based off the array… Here is my code.

cubicThumbs = [“Bracelet\_Nugget\_1\_thmb.jpg”,“Earring\_Nugget\_1\_thmb.jpg”,“Necklace\_Nugget\_1\_thmb.jpg”,“Earring\_Nugget\_1\_thmb.jpg”,“Necklace\_Nugget\_1\_thmb.jpg”];  
var YPos = -133;  
var XPos = 138;  
var numOfItems:Number;  
var vSpace = \_width+3;  
var hSpace = \_height+3;  
var n = 0;

function buildThumbs(){  
for (var i=0; i\<cubicThumbs.length; i++) {  
numOfItems = Math.round(i);  
var menu = attachMovie(“Btn”,“NewBtn”+i,i,{\_x:XPos,\_y:YPos});  
if (numOfItems\<=3){  
XPos += this[“NewBtn”+i].\_width+2;  
}else{  
// here is where I am stuck  
}  
menu.\_x = XPos;  
menu.\_y = YPos;

```
    this["NewBtn"+i].eclip.loadMovie(directory + cubicThumbs*);
}

```

}  
buildThumbs();

I have figured out how to display them all in one row, however I can not figure out how to , if there are more than 3 in the array to move down to a new row and so on…

Also if there are more than 9 to build the menu with 3 columns and 3 rows and then move over on the \_x 50 pixels and start over again at the top.

Can anyone help me? I am clueless.

Thanks
