views:

3840

answers:

2

is there a way to handle menuEvents like the ones used in submenus but in top level menus that doesent have sub menus?

and use a function like:

 private function menuHandler(event:MenuEvent):void  {
                if (event.item.@data != "top") {
                    Alert.show("Label: " + event.item.@label + "\n" + 
                        "Data: " + event.item.@data, "Clicked menu item");
                }        
            }

to Handle the clicks?

+1  A: 

You need to understand how to raise (or dispatch) your own events when someone clicks on one of your menu items

I suggest taking a look through this to get an idea about how to manage events in Flex.

The basics of what you need, will be to listen for MouseEvent.CLICK events on your button and then redispatching them as custom menu events (possibly containing data about which one has been clicked)

You may also want to take a look at the TabBar component as this probably contains all the functionality you may want for a menu bar.

James Hay
A: 

Hello Fortes, did you find out how to get the click Event on a top menu? I've the same issue, and the way i found is not optimal.

please answer me on [email protected].

Thanks.