Big troubles with onEnterFrame hitTesting

hi all,

so, i’ve a movieclip with an over / out animation inside.
when the mouse is over the movieclip, the over-animation should play,
and vice versa…

i’m doing this with a hitTest nested in an onEnterFrame-funtion.

here is my code in the first keyframe:

this.onEnterFrame = function():Void {
    if( my_button.hitTest(_xmouse, _ymouse, true) ) {
        my_button.play();
    }    
}

ok, so far so good…but now the part with the BIG problem comes in:
when the playhead reaches the stop()-keyframe inside my movieclip,
where the animation should stop, it doesn’t stop due to the onEnterFrame-function, which fires permanent play()…

so, my questions is:
how can i make movieclips with over / out - animations inside,
which should play, when the mouse is over / isn’t over the movieclip,
whithout loosing the precision of hitTesting?!?

maybe you know my problem, and maybe you even have solutions for this, it would be really cool, if somebody can help me out! :ko:

try
frame 1 of button MC;

stop();
this.onEnterFrame = function():Void  {
	if (this.hitTest(this._parent._xmouse, this._parent._ymouse, true)) {
		play();
	}
};

frame 10;

stop();
delete this.onEnterFrame;
this.onEnterFrame = function():Void  {
	if (!this.hitTest(this._parent._xmouse, this._parent._ymouse, true)) {
		play();
	}
};

frame 20;

gotoAndStop(1);
delete this.onEnterFrame;

but, why can’t you use onRollOver?

PS: Probably a better way… but it’s too early for me…

thx man, i’ll try it!

because the rollOver/rollOut events are not really precise, cause for example
when i rollOver my movieclip really really fast, the event does not check for some reason, wheter my mouse is actually over the movieclip or not…

sry, for my english…i’m tryin my best :wink:

hey man, hahaah…i tried it, and it worked perfect!!! big thx man…i nearly was goin mad on this…but you helped me…hhahahah

big thx man!