Hittest and dropmenu

Hi there,

I’m having trouble to get hittest to work. At least if this is the best method to use with the thing I’m trying to do…

Here’s the situation:
http://www.earfocus.com/debie/preview/index.htm

So what I want is that when you mouse over “navigation”, the dropdown menu becomes visible, and when you leave that same navigation, OR the dropdown menu itself, it disappears again… This last thing is giving me some difficulties.

Here is the code I use:

[AS]navigationBar_mc.onEnterFrame = function():Void {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
if(_root._xmouse >= 340 || _root._xmouse <= 428){
clearInterval(nInterval);
nInterval = setInterval(moveMenu, 50, nDown);
}
} else {
clearInterval(nInterval);
nInterval = setInterval(moveMenu, 50, nUp);
}
}[/AS]

And here is the function I call with the intervals:
[AS]function moveMenu(nYTargetMenu):Void {
_root.dropDown_mc._y += (nYTargetMenu - _root.dropDown_mc._y)/nSpeed;
}[/AS]

Am I doing things right here? Is hittest the way to go? I know you can achieve it with motiontweens instead of actionscript, but I rather do it the hard way :wink:

Or should I perhaps use some prototype function?

Any help is appreciated,
Sintax

seems like it would be simpler if you used the
myMovieClip.onRollOver = function(){
//code;
}
myMovieClip.onRollOut = function(){
//code;
}

The one problem you’re going to run into probably is that when you roll off one menu item to go to another, it’s going to execute the menu closing code most likely. Be clever in your code and its placement, and good luck!

–EP

That was actually my initial idea, but since i ran into this problem you mention, I thought hittest would be better.

But I’ve solved it now, I’ve put the dropdown menu and the navigationbar into one movieclip…

You’re right, it all comes down to clever programming and putting things into the right places :wink:

yup yup :slight_smile:

–EP