Centering Image within resizing frame

Im having problems of centering my images dead center of my resizing frame. Can someone help me to adjust this?

cheers:)

heres the code:

// All the credits go to Gorlim from www.flashxpress.net
// You need 2 clips in the library: btn and fond

cmpt = 0; //handles depth to attach
maxWidth =400; //of an image
maxHeight = 400; //of an image
nbEtapes = 20; //nb of steps for the resize
images = [“image1”,“image2”, “image3”, “image4”,“image5”,“image6”]; //names of the pics without “.jpg”

this.attachMovie(“fond”,“fond”, cmpt++);

//loadJpg called when you click a button
loadJpg = function () {
jpg._xscale = jpg._yscale=100;
//load the file corresponding to the button
jpg.loadMovie(images[Number(this._name.substr(3))]+".jpg");
//check the loading
fond.onEnterFrame = function() {
if (jpg.getBytesTotal()>0 && jpg.getBytesLoaded() == jpg.getBytesTotal()) {
// it’s over. We hide the pic until the end of the resize
jpg._visible = false;
// resize the image if pic too big
if (jpg._width>maxWidth || jpg._height>maxHeight) {
jpg._xscale = jpg._yscale=Math.min(100maxWidth/jpg._width, 100maxHeight/jpg._height);
}
// total width of the container
fondWidth = jpg._width+btns._width+30;
// increment
deltaX = Math.round((fondWidth-fond._width)/nbEtapes);
fondWidth=deltaX*nbEtapes+fond._width;
deltaY = Math.round((jpg._height+20-fond._height)/nbEtapes);

                     // actual resize
                     jpg.onEnterFrame = function() {
                             if ((fond._width<fondWidth && deltaX>0) || (fond._width>fondWidth && deltaX<0)) {
                                     fond._width += deltaX;
                                     fond._height += deltaY;
                                     btns._x = fond._width-btns._width+20;
                             } else {
                                     //resize over, delete onEnterFrame of the resize
                                     this._visible = true;
                                     delete this.onEnterFrame;
                             }
                     };
             }
             // delete the onEnterframe of the load
             delete this.onEnterFrame;
     };

};

// container of the buttons
this.createEmptyMovieClip(“btns”, cmpt++);
btns._x = btns._y=10;
for (var i = 0; i<images.length; i++) {
btns.attachMovie(“btn”, “btn”+i, i, {_y:20i, image:images, onRelease:loadJpg});
}

// container of the pics
this.createEmptyMovieClip(“jpg”, cmpt++);
jpg._x = jpg._y=10;
Report this post to a moderator | IP: Logged