Hit test

What is wrong with this AS? I cant get the hittest to work on these buttons which are now movieclips.

onClipEvent (enterFrame) {
 if (this.hitTest(_root._xmouse, _root._ymouse, true)) 
	if (_currentframe>=75) {
		gotoAndPlay(91);
 } else {
	if (_currentframe>=96) {
		gotoAndPlay(96);
		updateAfterEvent();
 }
}

[EDIT=Erased post]…and he missed![/EDIT]

:*(

Well for one you missed a curly bracket :slight_smile:

Not sure if that is the whole problem, but I can tell that one right off the bat…

onClipEvent (enterFrame) {
	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
		if (_currentframe>=75) {
			gotoAndPlay(91);
		} else {
			if (_currentframe>=96) {
				gotoAndPlay(96);
				updateAfterEvent();
			}
		}
	}
}

create an invisible mc and attach it to the mouse using

onClipEvent (mouseMove) {
_x=_root._xmouse
_y=_root._ymouse
updateAfterEvent(mouseMove)
}

give this mc an instance name like “mouseTarget” then use hitTest -

if (this.hitTest(_root.mouseTarget)) { }

I did this and worked perfect… so its not the hitTest that is the problem.

onClipEvent (enterFrame) {
	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
		trace("over");
	} else {
		trace("not over");
	}
}

You could try…

onClipEvent (enterFrame) {
	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
		if (_currentframe>=75 && _currentframe<=95) {
			gotoAndPlay(91);
		} else {
			if (_currentframe>=96) {
				gotoAndPlay(96);
				updateAfterEvent();
			}
		}
	}
}

Thanks for replying guys, but the problem continues. Basically what I have is a movie clip that alphas from 0 to 100 on rollover, that part is simple, but I also want it to control an alpha of a 2nd movie clip too. So when I rollover and rollout on that movieclip, it fades itself and another movieclip at the same time. I already achieved this with the rollover and rollout AS, but its not sensitive enough, if i roll my mouse over it too fast then it will be stuck on a state. I thought if I used the hittest, it would make it more sensitive to the mouse, but so far I havent been able to apply the hittest it. I hope you guys understand what I’m trying to do. :-\

Use AS to tween the alpha instead of a motion tween.

Thats the problem, I dont know how to do that, I wanna use the hittest to control the alphas of both movieclips, but so far no luck…

I will whip up an example…

::poof::

Wait… which version of Flash?

If it is MX, I can whip up an example, if it is Flash 5, hmmm, I can’t help ya there :frowning:

I’m using MX, thank goodness!! thanks Lost! I owe you big time on this cause its for a important project. =)

Ok, check my attachment :slight_smile:

I set the original alpha of the rollOver clip to 10 so you can see where you were rolling over to test it, so the animation of it may seem a bit off, but the idea is there.

I hope it was close to what you wanted to do :slight_smile:

Wait wait wait… I noticed a glitch in the last script where if you moused over it real fast over and over it made it invisible.

Try this one :slight_smile:

crazy lost! thats exactly what i needed, thanks man!! =)

No problem, always glad to help :slight_smile:

Especially on important projects :beam: