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:

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){
nInterval = setInterval(moveMenu, 50, nDown);
} else {
nInterval = setInterval(moveMenu, 50, nUp);

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;

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,

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

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!


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: