[FONT=Century Gothic]I have a row of boxes created with a for loop and attachMovie. The boxes are attached to an empty clip on stage. At this point I am able to move the entire row of boxes by moving the empty clip. What I’d really like to be able to do is move the entire row of boxes, but move the x position of each of the boxes you click on to a target x position. Any ideas on how I might do this?
the code i have so far:
function attachSlides(){
var total = 10;
for(i = 0; i < total; i++){
slides = mt.attachMovie("slide", "slide" + i, i);
slides._x = 55 * i;
slides.onRelease = function(){
currentX = this._x;
mt.ease(mt._x + 100,5,true);
}
}
}
MovieClip.prototype.ease = function(toX,speedX,roundX,toY,speedY,roundY){
this.onEnterFrame = function(){
if(toX!='' && toX!=undefined){
if(roundX!=true){
this._x += (toX - this._x)/speedX;
} else {
this._x += Math.round((toX - this._x)/speedX);
}
if(this._x >= toX-2 && this._x <= toX+2){
this._x = toX;
toX='';
//trace("Reached the X position");
if(toY==undefined || toY==''){
//trace("Movement complete");
delete this.onEnterFrame;
}
}
}
if(toY!='' && toY!=undefined){
if(roundY!=true){
this._y += (toY - this._y)/speedY;
} else {
this._y += Math.round((toY - this._y)/speedY);
}
if(this._y >= toY-2 && this._y <= toY+2){
this._y = toY;
toY='';
//trace("Reached the Y position");
if(toX==undefined || toX==''){
//trace("Movement complete");
delete this.onEnterFrame;
}
}
}
if((this._y == toY) && (this._x == toX)){
//trace("Movement complete");
delete this.onEnterFrame;
}
}
}
attachSlides();
[/FONT]