How do i centralize dynamically loaded thumbs

Hi guys,

I have been doing some studies on my own but i just cant figure 2 things out …

my prototype code doesnt seems to work and i cant seem to centralize this dynamically loaded thumbs via stage listener… can someone kindly helpe me with my code ? no idea why its not centralizing. Is there a way to load the thumbs one by one using the moviecliploader method ?

Thanks ~ !!


#include "lmc_tween.as"

var count:Number = -1;

sl = new Object();
sl.onResize = function() {
	scroller.container.tween("_x", Stage.width/2 - scroller.container._width/2, 1, "easeOutSine");	
};
Stage.addListener(sl);
sl.onResize();

makeThumbs();
function makeThumbs(){
	for( var i=0; i<8; i++){
		var thumbs:MovieClip = scroller.container.attachMovie("mcRect", "mcRect"+i, i);
		thumbs._visible = false;
		thumbs.endY = -1;
		thumbs.endX = i*(115);
		thumbs._x = 0;
	}
	nextThumbs();
}

function nextThumbs(){
	count++
	if (count<8){
		moveThumbs();
	}else{
		
	}
}

function moveThumbs(){
	var thumbsHolder:MovieClip = scroller.container["mcRect"+count];
	thumbsHolder._visible = true;
	thumbsHolder._y = 120;
	thumbsHolder._x = count*115;
	scroller.container.tween("_x", Stage.width/2 - scroller.container._width/2, .5, "easeOutQuad");
	thumbsHolder.tween("_y", 0, 0.5, "easeOutQuad");
	loadThumbs();		
}

/*pictures not loaded --- problem with code , need to further rectify problem
function moveThumbs(){
	var thumbsHolder:MovieClip = scroller.container["mcRect"+count];
	thumbsHolder.showThumbs();
}

MovieClip.prototype.showThumbs = function() {
	this._visible = true;
	this._y = 120;
	this._x = this.endX;
	scroller.container.tween("_x", Stage.width/2 - scroller.container._width/2, .5, "easeOutQuad");
	this.tween("_y", this.endY, 0.5, "easeOutQuad");
	loadThumbs();	
}*/


function loadThumbs(){
	var thumbsHolder:MovieClip = scroller.container["mcRect"+count];
	thumbsHolder.mcHolder.loadMovie("pics/th4.jpg");
	var tmp:MovieClip = this.createEmptyMovieClip("temp", "temp"+ count, 1000+count);
	temp.onEnterFrame = function(){
		BL = thumbsholder.mcHolder.getBytesLoaded();
		BT = thumbsholder.mcHolder.getBytesTotal();
		if(BL == BT && thumbsHolder.mcHolder._width>1){
			nextThumbs();
		}
	}
}