# Thumbnails grid layout

**URL:** <https://forum.kirupa.com/t/thumbnails-grid-layout/182847>\
**Category:** Uncategorized\
**Created:** [March 21, 2006, 10:31pm UTC](https://forum.kirupa.com/t/thumbnails-grid-layout/182847 "2006-03-21T22:31:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flash1810](https://avatars.discourse-cdn.com/v4/letter/f/258eb7/32.png) [@flash1810](https://forum.kirupa.com/u/flash1810)\
**Post date:** [March 21, 2006, 10:31pm UTC](https://forum.kirupa.com/t/thumbnails-grid-layout/182847/1 "2006-03-21T22:31:48Z")

</div>

hello.

i am trying to display a series of thumbnails (pulled from an xml file) using a grid layout. I am basically following the kirupa tutorial (xml photogallery w/ thumbnails) and i want to have a grid instead of a scroller…  
something like:

1 5  
2 6  
3 7  
4 8

at the moment i manage to put them in a single column, but i am having problems into finding a “formula” to make them sit in 2 columns.

following the tutorial i mentioned above, i am using a “counter” k and i basically trying to say :

if k\>4 then re-initialise x and y values and carry on…

that’s where i am having problems…

anybody has done this before?

sorry if this has been posted here already

thanks in advance for help. :}

D

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [March 22, 2006, 6:55am UTC](https://forum.kirupa.com/t/thumbnails-grid-layout/182847/2 "2006-03-22T06:55:14Z")

</div>

```auto
var rows = 4;
for (var i = 0; i<8; i++) {
	var mc = this["mc"+0];
	mc._x = Math.floor(i/rows);
	mc._y = i%rows;
}

```

scotty(-:
