Problem with changing positions of mc

Hi,
I am trying to make a photogallery with each external picture loaded separately into a containerMC by clicking thumbnails. To be able to define the mc:s _x and _y position I tried making this prototype:

MovieClip.prototype.picLoader = function(pic) {
    this.createEmptyMovieClip("theLoader", this.getNewDepth());
    this.theLoader.onEnterFrame = function() {
        if (_root.picMask._y<=-880) {
            _root.mainContainer.loadMovie(pic);
            this._x = _root.mainContainer._x;
            this._y = _root.mainContainer._y;
            if (_root.mainContainer.getBytesLoaded() ==_root.mainContainer.getBytesTotal()) {
                this._x = ((stage._width/2)-180)-_root.mainContainer._width/2;
                this._y = (stage._height/2)-this._height/2;
                _root.picMask.newy = 10;
                delete this.onEnterFrame;
            }
        } else if (picMask>=9) {
            _root.picMask.newy = -890;
            this.loadMovie(pic);
            if (_root.mainContainer.getBytesLoaded() ==_root.mainContainer.getBytesTotal()) {
                this._x = _root.mainContainer._x;
                this._y = _root.mainContainer._y;
                if (_root.mainContainer.getBytesLoaded() ==_root.mainContainer.getBytesTotal()) {
                    this._x = ((stage._width/2)-180)-_root.mainContainer._width/2;
                    this._y = (stage._height/2)-_root.mainContainer._height/2;
                    _root.picMask.newy = 10;
                    delete this.onEnterFrame;
                }
            }
        }
    };
};

It loads the picture fine and by changing the numbers around I can see that it calculates the x and y position. However it seems that it can’t determine the getBytesLoaded(). When I trace it trace(_root.mainContainer.getBytesLoaded()) it displays 4… When I trace _root.mainContainer._width I get 0.

I am calling the function with an onEnterFrame function with amongst other things, this:

                _root.mainContainer.picLoader("site_images/picture1.jpg");

What am I doing wrong? :-/