Positioning MC's (picture gallery)

Hi I’m new here and but have known about kirupa.com for several years now. I appreciate that the tutorials are always well written and easy to follow.

I’ve been following the tutorial to make my own flash gallery + scroll for my website, the tutorial can be found here (http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm).

After completing the tutorial I noticed that the picture generated in the image wouldn’t always be centered, because I have vertical and horizontal images in my gallery. I understand that the picture is drawn in the image instance under instance name picture starting from the top left corner. I took a look at the code and it seems to be doing most of the picture generation in the two functions prevImage and nextImage. I tried to write my own function to call within these codes to center the image and here it is.

function reposition(){
//check if the image width is less than 700
if (image[p].width < 700){
//set the coordinate further right since it will be a vertical picture
image[p].x = 298;
}else{
//set coordinate further left since it will be a horizontal picture.
image[p].x = 100;
}
}

I then proceeded to call this reposition in both prevImage and nextImage however the images have not moved. I have been trying to get this to work for sometime now and would appreciate it if someone could lend a hand :slight_smile: Here is a link to my gallery i’m making, as u can see it the vertical images are not centered. (http://skulehouse.cybersmart.ca/gallery/newcollege/ncgallery.html)