Resize function, help!

Hi

I took parts of the code from the resizing Gallery thread to achieve the same effect for my gallery.
Infortunately I can’t make things work properly.
What I’m triyng to achieve is a fixed y position with horizontally centered images and border.
Until now it looks like this: >>link<<, gallery 1

This is the current code:

var spacing = 10;
loader._visible = false;
function showImg(img) {
 this.onEnterFrame = function() {
  loadImg(img);
  mx.transitions.TransitionManager.start(container, {type:mx.transitions.Fade, direction:0, duration:2, easing:mx.transitions.easing.Regular.easeOut});
 };
}
function loadImg(img) {
 container._visible = false;
 container.loadMovie(img);
 loader.init();
 this.onEnterFrame = function() {
  var cur = container.getBytesLoaded();
  var max = container.getBytesTotal();
  if (cur>10 && max>10) {
   var percent = cur*100/max;
   loader.setPerc(percent);
   if (percent>=100 & container._width>10 && container._height>10) {
    var w = container._width+spacing, h = container._height+spacing;
    border.resizeMe(w, h);
    container._visible = true;
   }
  }
 };
}
MovieClip.prototype.resizeMe = function(w, h, img) {
 var speed = 3;
 this.onEnterFrame = function() {
  this._width += (w-this._width)/speed;
  this._height += (h-this._height)/speed;
  if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
   this._width = w;
   this._height = h;
   container._x = this._x-container._width/2-spacing/2;
   container._y = this._y-container._height/2-spacing/2;
   delete this.onEnterFrame;
  }
 };
};

What I’m doing wrong and why does the container/image jump to position?