I have this script and it loads each clip into a position defined in “locationsArray”. Once loaded they trigger a function which moves them to targX, targY. I need targX and targY to be different values for each MC . Here is my code
/////////////////////////////
/////////////////////////////
var easing = 0.2;
var targX = -10;
var targY = 250;
//reference to this timeline
var owner = this;
function preload(target, n) {
var loadedbytes = target.getBytesLoaded();
var totalbytes = target.getBytesTotal();
if (loadedbytes>10 && loadedbytes>=totalbytes) {
clearInterval(owner["preload"+n]);
//now the jpg/swf is fully loaded we can call the doEase function
doEase(target);
}
}
/////////////////////////////
/////////////////////////////
namesArray = new Array("bg", "widget1", "widget2", "widget3", "MainLogo", "MainMessage");
locationsArray = new Array([0, 0], [-500, 250], [275, 225], [445, 250], [530, 105], [410, 23]);
for (var i = 0; i<namesArray.length; i++) {
//create a clip on the root using a reference
var container = this.createEmptyMovieClip(namesArray*+"_mc", i);
container._x = locationsArray*[0];
container._y = locationsArray*[1];
if (i == 0) {
container.loadMovie("images/"+namesArray*+".jpg");
} else if (i == 1) {
container.loadMovie("images/"+namesArray[1]+".swf");
owner["preload"+i] = setInterval(preload, 100, container, i);
} else if (i == 2) {
container.loadMovie("images/"+namesArray[2]+".swf");
owner["preload"+i] = setInterval(preload, 300, container, i);
} else if (i == 3) {
container.loadMovie("images/"+namesArray[3]+".swf");
owner["preload"+i] = setInterval(preload, 500, container, i);
} else if (i<=5) {
container.loadMovie("images/"+namesArray*+".swf");
}
}
/////////////////////////////
/////////////////////////////
function doEase(target) {
target.onEnterFrame = function() {
var dx = targX-this._x;
var dy = targY-this._y;
if (Math.abs(dx)<=1) {
this._x = targX;
this._y = targY;
delete this.onEnterFrame;
trace("onEnterFrame removed on: "+this);
} else {
var vx = dx*easing;
var vy = dy*easing;
this._x += vx;
this._y += vy;
}
};
}