Positioning problem with sliding grid

Scene: 450 px width. and the boxes(instance name:dot) are 50 px each.

The AS on the timeline:

// IMAGE


gridx = 60;
 gridy = 60;
 num = 0;
 mcArray = [];
 dot._visible = 0;
 for (var i = 0; i<21; i++) {
 	for (var j = 0; j<1; j++) {
 		var mc = dot.duplicateMovieClip("dot"+num, num);
 		mcArray.push(mc);
 		mc._x = 45+gridx*i;
 		mc._y = 40+gridy*j;
 		mc._xscale = mc._yscale=0;
 		mc._alpha = 80;
 		num++;
 		trace("Num:"+num+" Mc:"+mc);
 	}
 }
 id = setInterval(this, "scaleDot", 100);
 var nr = 0;
 function scaleDot() {
 	var dotd = this["dot"+nr];
 	nextDot();
 	dotd.gotoAndPlay(2);
 	dotd.onEnterFrame = function() {
 		this._xscale = 100-(100-this._xscale)/1.5;
 		this._yscale = this._xscale;
 		if (Math.abs(this._xscale-100)<1) {
 			this._yscale = this._xscale-=5;
 			delete this.onEnterFrame;
 		}
 	};
 }
 function nextDot() {
 	if (nr<mcArray.length-1) {
 		nr++;
 	} else {
 		attachPic();
 		clearInterval(id);
 	}
 }
 
 /*
 mcArray.sort(shuffle);
 function shuffle() {
 	return Math.round(Math.random());
 }
 */
 
 var d = 0;
 function attachPic() {
 	var mc = mcArray[d];
 	mc.box.loadMovie("photos/thumbs/th"+d+".jpg");
 	mc.box._alpha = 0;
 	var temp = _root.createEmptyMovieClip("tmp"+d, 900+d);
 	temp.onEnterFrame = function() {		
 	//trace(mc.box.getBytesTotal());
		if (mc.box.getBytesLoaded() == mc.box.getBytesTotal() && mc.box.getBytesTotal()>4) {
 			nextThumb();
 			mc.box._alpha +=5;
 			mc.box._x = -25;
 			mc.box._y = -25;
 			if (mc.box._alpha>80) {
 				mc.box._alpha = 80;
 				delete this.onEnterFrame;
 			}
 		}
 	}
 }
 
 
 function openPic(p) {	
 _root.imageHolder.loadMovie("photos/pics/im"+p+".jpg");
 _root.imageHolder._alpha = 0;
 	var temp = _root.createEmptyMovieClip("tmpmov"+p, 900+p);
 	temp.onEnterFrame = function() {		
 		if (_root.imageHolder.getBytesLoaded() == _root.imageHolder.getBytesTotal() && _root.imageHolder.getBytesTotal()>4) {
 			_root.imageHolder._alpha += 5;
 			if (_root.imageHolder._alpha>100) {
 				_root.imageHolder._alpha = 100;
 		delete this.onEnterFrame;
 			
 			}
 		}
 	};
 }
 
 function nextThumb() {
 	if (d<21) {
 		d++;
 		attachPic();
 	} else {
 		setThumbs();
 	}
 }
 
 	
 	
 function setThumbs(){
 	for (var i=0; i<21; i++){
 		var thb = mcArray*;
 
 		thb.onRollOver = function(){
 		my_color = new Color(this.bg)
 		my_color.setRGB(0xff0799);	
 		this._alpha = 100;
 			with(this) {
 			myName = this._name;
 			newLength = myName.length;
 			subbed = (newLength-3);
 			myNumber = myName.substr(newLength-subbed, subbed);
 			//trace(subbed);	
 						}
		    		    trace(myNumber);
 	
 					}
 		
 		thb.onRollOut = function(){
 		my_color = new Color(this.bg)
 		my_color.setRGB(0x333333);
 		this._alpha = 80;
 		_root.but_info.selected_but = "";
 						}
 					
 	thb.onRelease = function() {
 		my_color = new Color(this.bg)
 		my_color.setRGB(0xff0799);
 			with(this) {
 			myName = this._name;
 			newLength = myName.length;
 			subbed = (newLength-3);
 			myNumber = myName.substr(newLength-subbed, subbed);
 			//trace(subbed);	
 			}
 			
 		openPic(myNumber);
 		_root.mypath = "photos/pics/im"+myNumber+".jpg";
 
 


The AS on the box itself

onClipEvent (load)
{
// _x=30;
xcenter=150;
speed=1/10;
trace(“X:”+_x);

}

onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x-=(distance*speed);
if (_x > 1250) _x=0;
if (_x < -810) _x=450;
}

And when It start to slide after a li,ttle time the images start to stack on top of each other. How can I solve this ?