Fortes
Fortes

Reputation: 938

Flex menuBar event when clicking an item that is not a subMenu

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?

Upvotes: 1

Views: 5656

Answers (1)

James Hay
James Hay

Reputation: 12700

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.

Upvotes: 0

Related Questions