-
if(i>$){i=:);}
delete onEnterFrame
Hi, It won't delete the onEnterFrame. grrr. It has something to deal will AS2 OOPs right?
code:
MovieClip.prototype.tween = function(prop, finalValue, tweenSpeed) {
var prop:Array;
var finalVal:Array;
var tweenSpeed:Number;
if (tweenSpeed == undefined) {
tweenSpeed = .09;
}
this.onEnterFrame = function() {
for (var i = 0; i<=(prop.length-1); i++) {
//easeOut
this[prop[i]] += (finalValue[i]-this[prop[i]])*tweenSpeed;
}
if (this[prop[0]] == finalValue[0]) {
delete onEnterFrame;
trace("deleted!!!!");
}
trace(this[prop[0]]+" / "+finalValue[0]);
};
};
//
onMouseDown = function () {
box.tween(["_xscale", "_yscale"], [400, 500], .09);
};
-
try this:
MovieClip.prototype.tween = function(prop, finalValue, tweenSpeed) {
var prop:Array;
var finalVal:Array;
var tweenSpeed:Number;
if (tweenSpeed == undefined) {
tweenSpeed = .09;
}
this.onEnterFrame = function() {
for (var i = 0; i<=(prop.length-1); i++) {
//easeOut
this[prop[i]] += (finalValue[i]-this[prop[i]])*tweenSpeed;
}
if (parseInt(this[prop[0]]) == parseInt(finalValue[0])) {
delete this.onEnterFrame;
trace("deleted!!!!");
}
trace(this[prop[0]]+" / "+finalValue[0]);
};
};
//
onMouseDown = function () {
box.tween(["_xscale", "_yscale"], [400, 500], .09);
};
-
if(i>$){i=:);}
Right on, That did it! Now I need to do it for all the arrays I wrote? The code I wrote earlier that you fixed just checks for array[1] to complete before it deletes the onEnterFrame. I forgot to change it to all arrays[i] before posting. oops. Anyways how can I script it so it won't delete the onEnterFrame untill ALL arrays match up. In the example below theres only 2 items in each array.
Thanks
code:
MovieClip.prototype.tween = function(prop, finalValue, tweenSpeed) {
var prop:Array;
var finalVal:Array;
var tweenSpeed:Number;
if (tweenSpeed == undefined) {
tweenSpeed = .09;
}
this.onEnterFrame = function() {
for (var i = 0; i<=(prop.length-1); i++) {
//easeOut
this[prop[i]] += (finalValue[i]-this[prop[i]])*tweenSpeed;
if (parseInt(this[prop[i]]) == parseInt(finalValue[i])) {
delete onEnterFrame;
trace("deleted!!!!");
}
trace(this[prop[i]]+" / "+finalValue[i]);
}
};
};
//
onMouseDown = function () {
box.tween(["_xscale", "_yscale"], [400, 500], .09);
};
Last edited by falshdancer; 09-05-2005 at 03:31 PM.
la la la la laaaaaaa
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|