Package | Top Level |
Class | public class Menu |
-- Create a new menu menu = Menu:new("My menu") -- Create a new menu item menuItem = MenuItem:new("my menu item") -- (Optional) Give the item an id that can be used later on to track a menu item menuItem:setId("some id") -- (Optional) The "tag" property can be used to attach additional data to the menu item menuItem:setTag("some extra info") -- (Optional) Name of the function that is going to be called when/if the menu item is selected menuItem:setOnSelected("menuItem_selected") -- Add the menu item to the menu subMenu:append(menuItem) function menuItem_selected(event) trace("Menu item with id ", event.menuItem:getId(), " and tag ", event.menuItem:getTag(), " was clicked") end
Method | Defined by | ||
---|---|---|---|
Menu(menuLabel:String)
Constructor.
| Menu | ||
Appends a menu item to the menu.
| Menu | ||
appendSeparator():void
Appends a separator item to the menu.
| Menu | ||
appendSubMenu(menu:Menu):void
Appends a submenu to the menu.
| Menu |
Menu | () | constructor |
public function Menu(menuLabel:String)
Constructor.
ParametersmenuLabel:String — Menu label.
|
append | () | method |
public function append(menuItem:MenuItem):void
Appends a menu item to the menu.
ParametersmenuItem:MenuItem — Menu item to append to the menu.
|
appendSeparator | () | method |
public function appendSeparator():void
Appends a separator item to the menu.
appendSubMenu | () | method |
public function appendSubMenu(menu:Menu):void
Appends a submenu to the menu.
Parametersmenu:Menu — Submenu to append to the menu.
|
-- Create the submenu submenu = Menu:new("My menu") -- Append an item to it menuItem = MenuItem:new("submenu item") submenu:append(menuItem) -- Append the submenu to an existing menu someMenu:appendSubMenu(submenu)