Hey guys, come on!!! A little help here. PLEEEEEEEEEEEASE!!!
I’m trying to get the images on my gallery to resize. I tried several times but was unsuccessful at it.
Here’s how it looks now:
this.onEnterFrame = function() {
filesize = container_mc.picture_mc.getBytesTotal();
loaded = container_mc.picture_mc.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (container_mc.picture_mc._alpha<100) {
container_mc.picture_mc._alpha += 10;
}
if(container_mc.picture_mc._width > 0) {
resizeImage();
}
container_mc.picture_mc._x = (container_mc._width-container_mc.picture_mc._width)/2;
container_mc.picture_mc._y = (container_mc._height-container_mc.picture_mc._height)/2;
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
container_mc.picture_mc._alpha = 0;
container_mc.picture_mc.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
container_mc.picture_mc._alpha = 0;
container_mc.picture_mc.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
if (container_mc.picture_mc._width>0) {
}
}
}
function firstImage() {
if (loaded == filesize) {
container_mc.picture_mc._alpha = 0;
container_mc.picture_mc.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
_global.resizeImage = function() {
//maximum image dimensions
wMax = 420;
hMax = 340;
if (container_mc.picture_mc._width>wMax || container_mc.picture_mc._height>hMax) {
//which dimension is the most oversized
wDiff = container_mc.picture_mc._width-wMax;
hDiff = container_mc.picture_mc._height-hMax;
//calculate ratio
if (wDiff>hDiff) {
ratio = (wMax/container_mc.picture_mc._width)*100;
} else {
ratio = (hMax/container_mc.picture_mc._height)*100;
}
} else {
//if image doesn't need to be resized set ratio to 100
ratio = 100;
}
container_mc.picture_mc._xscale = container_mc.picture_mc._yscale=ratio;
};
As it is, the picture just keeps resizing itself non-stop. I already tried to use the resizeImage(); in the nextImage and prevImage functions, but it would only resize the images some times.
Anyone care to enlighten me on where I might be wrong? Any help will be welcome! Thanks in advance for any answers!:thumb: