I tried using this code because I need some mc to scale, others to fade, and others to move; but it won’t work. It only allows the last function to work (in this case alpha).
something like this
MovieClip.prototype.tweenTo = function(targetsObj, speed, callbackObj, callbackFunc) {
this.targetsObj = targetsObj;
this.speed = speed;
this.callBackObj = callBackObj;
this.callBackFunc = callBackFunc;
this.onEnterFrame = function() {
var count;
for (var prop in this.targetsObj) {
this[prop] += (this.targetsObj[prop]-this[prop])/this.speed;
if (Math.abs(this.targetsObj[prop]-this[prop])<0.4) {
this[prop] = this.targetsObj[prop];
delete this.targetsObj[prop];
}
count++;
}
if (!count) {
clip.callBackObjclip.callBackFunc;
delete this.onEnterFrame;
}
};
};
var obj = {_x:200, _y:200, _alpha:20, _height:200, _width:200};
mc.tweenTo(obj, 5);
you may have to add more variables if you are wanting different speeds.I`ve adapted this from something else so you may not need the callbackobj,callbackfunc but may be useful to you.
its poor design of the prototypes. They shouldnt set onEnterFrame (a movieclip only gets one, any greedy prototype that sets it will override any existing onEnterFrame, including those set by other greedy prototypes). Instead you should consider dropping the onEnterFrame within the prototype methods and instead have them called within the target clips own onEnterframe
I am trying to make a menu that stays the exact same space (_x, _y) from the top corner of a movie I am scaling. This code o[font=‘Times New Roman’]bviously[/font] doesn’t work. How would I go about doing that.