[FMX] question about onCLipEvent

Hello,

I have the following script on a movie clip which fades the clip in when your mouse is over the MC and fades it out when your mouse moves off. It works fine, but it “flickers” when its faded in all the way. How can I stop that?

[AS]

onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.onEnterFrame = function() {
if (this._alpha<80) {
this._alpha += 3;
} else {
this._alpha = 80;
delete this.onEnterFrame;
}
};
} else {
this.onEnterFrame = function() {
if (this._alpha>40) {
this._alpha -= 3;
} else {
this._alpha = 40;
delete this.onEnterFrame;
}
};
}
}

[/AS]

Ok, the problem is that when you set something like an alpha, or even an _x or _y, Its not EXACTLY EXACTLY the same number to the N’th decimal.
Just replace
this._alpha = 80;
with
this._alpha = 81;

set up a trace, or a textbox with the 81 and without the 81… so you can see that when the alpha of your MC is set the old way its bouncing back and forth between like 78 - 81.