This is the file i have been playing about with basically it just loops through an array of properties.
here is the code used
k = 0;
function init() {
obj0 = [{_xscale:100, _yscale:100}, {_x:500, _y:400}, {_xscale:300, _yscale:300}, {_xscale:50, _yscale:50}, {_x:700, _y:100}, {_rotation:90, _alpha:50}, {_xscale:200, _yscale:200}, {_xscale:100, _yscale:100}, {_x:500, _y:400}, {_rotation:-90, _alpha:100}];
obj1 = [{_xscale:100, _yscale:100}, {_x:100, _y:300}, {_xscale:50, _yscale:50}];
obj2 = [{_xscale:100, _yscale:100}, {_x:700, _y:100}, {_xscale:200, _yscale:200}];
obj3 = [{_xscale:100, _yscale:100}, {_x:500, _y:400}, {_xscale:300, _yscale:300}];
}
MovieClip.prototype.ease = function(ob) {
for (var prop in ob[0]) {
this[prop] += (ob[0][prop]-this[prop])/5;
if (Math.abs(ob[0][prop]-this[prop])<1) {
this[prop] = ob[0][prop];
//trace(ob[k][prop]);
trace(ob[0][prop]);
delete ob[0][prop];
count++;
if (count == 2) {
ob.splice(0, 1);
count = 0;
}
if (ob.length == 0) {
delete this.onEnterFrame;
}
}
}
};
init();
for (var i = 0; i<4; i++) {
clip = this.attachMovie("btn", "btn"+i, i);
clip._x = 200+clip._width*i;
clip._y = 350;
clip.ivar = i;
clip.onPress = function() {
init();
mc.onEnterFrame = function() {
this.ease(this._parent["obj"+arguments.callee.ivar]);
};
mc.onEnterFrame.ivar = this.ivar;
};
}
This works fine as i have it but i am limited to only 2 properties per object within an array. So i couldn`t have {_x:500, _y:400,_xscale:200,_rotation:90} because of the count in the main function.(it does actually work to a point but is a little unpredicatable)
Can anyone think of another way of checking the number of properties in each object
edit/i already thought of including a count in each object but it just seems really inefficient.