# Thumbnails gallery

**URL:** <https://forum.kirupa.com/t/thumbnails-gallery/232197>\
**Category:** Uncategorized\
**Created:** [July 11, 2007, 8:56pm UTC](https://forum.kirupa.com/t/thumbnails-gallery/232197 "2007-07-11T20:56:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![doleman](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@doleman](https://forum.kirupa.com/u/doleman)\
**Post date:** [July 11, 2007, 8:56pm UTC](https://forum.kirupa.com/t/thumbnails-gallery/232197/1 "2007-07-11T20:56:13Z")

</div>

Hello, i modified kirupas thumbnail gallery script to generate a grid thumbnail gallery:

the old script was like in the tutorials:  
…  
tlistener.onLoadInit = function(target\_mc) {  
target\_mc.\_x = hit\_left.\_x+(target\_mc.\_width+5)\*k;  
target\_mc.pictureValue = k;  
target\_mc.onRelease = function() {  
p = this.pictureValue-1;  
nextImage();  
};  
…

i modified it to align the thumbnails on a grid:

tlistener.onLoadInit = function(target\_mc) {  
if ( target\_mc.\_width \< target\_mc.\_height) {  
target\_mc.\_width = 24;  
target\_mc.\_height = 36;  
target\_mc.\_x = posx + 17;  
target\_mc.\_y = posy;  
posx += 65;  
}  
else {  
target\_mc.\_width = 60;  
target\_mc.\_height = 36;  
target\_mc.\_x = posx;  
target\_mc.\_y = posy ;  
posx += target\_mc.\_width +5;  
}  
if (posx \> 220) {  
posx = 0;  
posy += target\_mc.\_height + 5;  
}  
trace (“x,y”+target\_mc.\_x +","+target\_mc.\_y);  
target\_mc.pictureValue = k;

this does the following:  
first it checks if it is a landscape thumbnail or a portrait, then it sets the width/height for the pictures.  
after it puts thumbnails in x direction until 220 is reached then it adds a row (posy) and starts from the first column.  
This works fine in Internet explorer. But in firefox 2.0.0.4 and flash player 9 i get random order of the thumbnails. The scrolling thumnails script worked for me in firefox…  
Any ideas? thanks
