# How to load images according to its dimension in the Gallery

**URL:** <https://forum.kirupa.com/t/how-to-load-images-according-to-its-dimension-in-the-gallery/252236>\
**Category:** flash\
**Created:** [February 18, 2008, 9:25am UTC](https://forum.kirupa.com/t/how-to-load-images-according-to-its-dimension-in-the-gallery/252236 "2008-02-18T09:25:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wendiland](https://avatars.discourse-cdn.com/v4/letter/w/5fc32e/32.png) [@wendiland](https://forum.kirupa.com/u/wendiland)\
**Post date:** [February 18, 2008, 9:25am UTC](https://forum.kirupa.com/t/how-to-load-images-according-to-its-dimension-in-the-gallery/252236/1 "2008-02-18T09:25:00Z")

</div>

Hello All!

I am creating a dynamic image gallery, but when my external images load in the empty movie clip, all the images are loading in the same size/dimension. Does anyone know how I can command the MC to load the images in different sizes, another words - to load them according to its own size?

here’s the AS

onClipEvent (load)  
{  
function imageMove()  
{  
var \_loc1 = this;  
for (i = 1; i \<= num\_of\_image; i++)  
{  
mc = \_loc1[“image” + i];  
if (i \< hit)  
{  
tempx = small \* (i - 1) + 30;  
temps = small - 5;  
mc.useHandCursor = true;  
}  
else if (i \> hit)  
{  
tempx = big + small \* (i - 2) + 30;  
temps = small - 5;  
mc.useHandCursor = true;  
}  
else  
{  
tempx = small \* (i - 1) + 150; //distance of how far out the displayed image jumps.  
temps = big - 5; //distance between the displayed image and thumbnails.  
mc.swapDepths(1000);  
display = txt\*;  
mc.useHandCursor = false;  
} // end else if  
mc.\_x = mc.\_x + (tempx - mc.\_x) / 3; //number of pixals on x-axis the displayed image moves over to right side before growing big.  
mc.\_width = mc.\_width + (temps - mc.\_width) / 3; //number of pixals on x-axis the displayed image moves over to left side before growing big.  
mc.\_height = mc.\_width \* 4 / 3;  
if (Math.abs(mc.\_width - temps) \<= 1)  
{  
title.\_x = hit \< 5 ? (\_loc1[“image” + hit].\_x + big / 2) : (\_loc1[“image” + hit].\_x - big / 2 - 100);  
title.\_y = 100;  
} // end if  
} // end of for  
} // End of the function  
function loopHye()  
{  
if (hit != num\_of\_image)  
{  
++\_global.hit;  
}  
else  
{  
\_global.hit = 1;  
} // end else if  
} // End of the function  
getURL(“FSCommand:allowscale”, false);

big = 300;  
//Large image width (400 works best for my portfolio site)  
small = 60;//Small image width (40 works well for my portfolio site)  
num\_of\_image = 8;//Total number of images  
timeGap = none;//Speed (speed of gaptime when each image is displayed automatically. “2000” is default of this original file. larger the number the slower the image changes. (type in “none” will stop automatic images from changing.  
\_global.hit = 0;//First displyed image number (type “0” to stop images from growing out)  
txt = [" ", “image1”, “image2”, “image3”, “image4”, “image5”, “image6”, “image7”, “image8”];//insert text of each images between " "  
for (i = 1; i \<= num\_of\_image; i++)  
{  
attachMovie(“image”, “image” + i, i);  
loadMovie(“image/” + i + “.jpg”, this[“image” + i].tar);//image folder path  
mc = this[“image” + i];  
mc.\_x = small \* (i - 1) + 30;  
mc.\_y = 200; //where on the axis should the displays be.  
mc.\_width = small - 5;  
mc.\_height = mc.\_width \* 4 / 3;  
this[“image” + i].onRelease = function ()  
{  
clearInterval(interval);  
\_global.hit = this.\_name.substr(5);  
interval = setInterval(loopHye, timeGap);  
};  
} // end of for  
interval = setInterval(loopHye, timeGap);  
}  
onClipEvent (enterFrame)  
{  
imageMove();  
}

* * *

this is what the current gallery looks like  
[http://www.wendiland.com/print2.html](http://www.wendiland.com/print2.html)

check out the file by downloading  
[http://www.wendiland.com/Gallery122b.fla](http://www.wendiland.com/Gallery122b.fla)

I’d appreciated if someone replies with any sort of suggestions! thanks in advance!!!

- W£NDI
