'delete this.onEnterFrame' troubles

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;
		}
	}
};

Lets make some output here:

blank_mc._y += (targetY-blank_mc._y)/10;

(220 - 0) / 10 = 22
(220 - 22) / 10 = 19.8
...
...
(220 - 219) / 10 = 0.1
(220 - 219.1) / 10 = 0.09
(220 - 219.19) / 10 = 0.81

See? Never gona be higher then the targetY. If you want 10 steps to get to final destination, so, keep the first value in a variable.

:h: I’m afraid I’m not following… can you explain further?

Balala ment that the blank_mc._y will never reach the targetY so it keeps looping.

try
[AS]
var targetY = 220;
this.onEnterFrame = function() {
if (Math.abs(blank_mc._y-targetY)>1) {
blank_mc._y += (targetY-blank_mc._y)/10;
trace(“ease”);
}else {
delete this.onEnterFrame;
}
};
[/AS]

I think I got it. thanks guys:)