# Reusable menu class with active state and listeners

**URL:** <https://forum.kirupa.com/t/reusable-menu-class-with-active-state-and-listeners/288769>\
**Category:** flash\
**Created:** [May 20, 2009, 7:25pm UTC](https://forum.kirupa.com/t/reusable-menu-class-with-active-state-and-listeners/288769 "2009-05-20T19:25:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThinkKirupa](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@ThinkKirupa](https://forum.kirupa.com/u/ThinkKirupa)\
**Post date:** [May 20, 2009, 7:25pm UTC](https://forum.kirupa.com/t/reusable-menu-class-with-active-state-and-listeners/288769/1 "2009-05-20T19:25:43Z")

</div>

Hi,

I’m trying to make a good menu. A reusable menu. I want to have a menu class that handels a group of buttons, listens and knows which is active and respond by going to a frame in a movieclip.

Say I have 4 buttons extending a class MenuButton which handels ROLL\_OVER and ROLL\_OUT states.

Then I want to have a class Menu that can group all 4 buttons. Only one of the included buttons can be “chosen” at the same time (like radiobuttons). When I press a MenuButton, say **button3** , I want my Menu to think “ooh, a button pressed! let’s act. Hmm, the button pressed was button1 I have been told. I will now change the active button **button3** , I’ll disable it and make it glow (or should the button do that himself?)”. “Ooh, the content. MovieClip go to and stop frame 3, please.”

I have been looking into the eventDispatcher but I don’t know if that’s overkill, i actually don’t fully understand it. I then think I’ll have a Menu.as, MenuButton, MenuButtonEvent.

I just want some hints about the best way to make this.

As usual I find it hard to explain what I want…
