FadeIn FadeOut prototype

Hi all,

I use these prototypes for fading in and out stuff.

They work fine, but the fadeOut prototype only seems to work correctly when I use

this.onEnterFrame = null
instead of
this.onEnterFrame = null

Does any one know why this is so.

[AS]
MovieClip.prototype.fadeIn = function(target, num, limit) {
target.onEnterFrame = function() {
this._alpha += num;
if (this._alpha>=limit) {
this._alpha = limit;
delete this.onEnterFrame;
}
};
};

MovieClip.prototype.fadeOut = function(target, num, limit) {
target.onEnterFrame = function() {
this._alpha -= num;
if (this._alpha<=limit) {
this._alpha = limit;
this.onEnterFrame = null;
}
};
};
test_mc.fadeOut(test_mc, 20, 10);
[/AS]