# Buttons not functioing on menu

**URL:** <https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114>\
**Category:** flash\
**Created:** [September 13, 2004, 11:58am UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114 "2004-09-13T11:58:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ntshp](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ntshp/32/746_2.png) [@ntshp](https://forum.kirupa.com/u/ntshp)\
**Post date:** [September 13, 2004, 11:58am UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114/1 "2004-09-13T11:58:42Z")

</div>

I have a menu that pops out on rollover and then goes back in on rollout.  
The problem is anything placed on the menu either buttons or movieclips do not seem to function any ideas why this happens or how to overcome it?

The structure is as follows  
\_root  
menu\_mc (with in/out animation)  
menugfx\_mc(movieclip that contains the menu bar/buttons)  
menu\_gfx  
buttons

Now the menu goes up and down just fine but the buttons refuse to work

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 12:25pm UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114/2 "2004-09-13T12:25:00Z")

</div>

Use hitTest for the rollover/rollout thing;)

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 1:33pm UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114/3 "2004-09-13T13:33:20Z")

</div>

thx 🙂  
After giving it a try the buttons are now working  
Im having trouble getting it to work though, whats the best way to use this function?

This is what im doing at the moment but doesnt seem to work, the menu seems to pop-up at what looks like to me at random x/y cords :S

onClipEvent (enterFrame) {  
if (hitTest(\_root.\_xmouse, \_root.\_ymouse, false)) {  
this.gotoAndPlay(“menuIn”);  
}  
}  
I basically want it to pop up if the mouse is over the movieclip

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 2:02pm UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114/4 "2004-09-13T14:02:14Z")

</div>

Can you post your .fla?

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 2:19pm UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114/5 "2004-09-13T14:19:13Z")

</div>

thx for helping me out 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 2:48pm UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114/6 "2004-09-13T14:48:42Z")

</div>

The problem is that when the hit test is true every onenterframe your going to play “menuIn”, so your menu\_mc will not run properly (ie starts over and over again at “menuIn”) I introduced a new variable, so the if statement is only true one moment, which will run menu\_mc.

```auto
onClipEvent (load) {
	var hit = 0;
}
onClipEvent (enterFrame) {
	if (this.hitTest(_root._xmouse, _root._ymouse) && !hit) {
		this.gotoAndPlay("menuIn");
		hit = 1;
	} else if (!this.hitTest(_root._xmouse, _root._ymouse) && hit) {
		this.gotoAndPlay("menuOut");
		hit = 0;
	}
}

```

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 2:54pm UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114/7 "2004-09-13T14:54:59Z")

</div>

he he i just realised that

> onClipEvent (enterFrame) {  
> if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse) && !this.mouseover) {  
> this.gotoAndPlay(“menuIn”);  
> this.mouseover = true;  
> } else if (!this.hitTest(\_root.\_xmouse, \_root.\_ymouse) && this.mouseover) {  
> this.gotoAndPlay(“menuOut”);  
> this.mouseover = false;  
> }  
> }

I didnt declare it on load though, but it works pretty much the same as what you have, wow I feel proud that I did it myself, but thx so much for helping out

One other problem is if someone(myself :P) wanted to annoy the menu by getting my pointer into the region before it gets a chance to finish it remains there with no animation.  
Is there anyway to make sure whenever the mouse is in that region the meny stays popped out, or picks up the animation from where it is currently?

I tried searching around for something that would work out where the animation is at present and then continue from that point in the opposite way but no luck ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 3:13pm UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114/8 "2004-09-13T15:13:19Z")

</div>

Not sure if you mean it like this.  
I took all the keyframes away and made an easing function.

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 4:11pm UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114/9 "2004-09-13T16:11:11Z")

</div>

[/center]  
Exactley what I meant, just making out how that function works

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 14, 2004, 9:25am UTC](https://forum.kirupa.com/t/buttons-not-functioing-on-menu/64114/10 "2004-09-14T09:25:08Z")

</div>

welcome:thumb:
