I’m using a number of onEnterFrame functions in my project and to slow down the CPU consumption I want to delete them when they’ve done their job. I’ve got this code to work with things like alpha fades, but the delete this.onEnterFrame doesn’t work with the easeing code. I think it’s the division part of the code that’s affecting it. Can someone lend me a hand?
Thanks,
GD
var targetY = 220;
this.onEnterFrame = function() {
if (blank_mc._y<targetY) {
blank_mc._y += (targetY-blank_mc._y)/10;
trace("ease");
if (blank_mc._y>targetY) {
delete this.onEnterFrame;
}
}
};