Packagecom.soma.model
Classpublic class MenuManager

Author: Romuald Quantin - www.soundstep.com

Information:
Blog page - SomaUI
How does it work - Soma Protest
Project Host - Google Code
Documentation - Soma ASDOC
Class version: 2.0
Actionscript version: 3.0

Copyright:

The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and
limitations under the License.

The Original Code is Soma.
The Initial Developer of the Original Code is Romuald Quantin.
Initial Developer are Copyright (C) 2008-2009 Soundstep. All Rights Reserved.

Usage:
The MenuManager allows you to easily register and retrieve your menu class instances for later use. The process for the Main Menu registered in the Config file (Soma.getInstance().config.menuClassName) is automatically done by Soma. The global menu manager instance is accessible using:

Soma.getInstance().menu
The main menu registered in the config file can retrieved that way:
Soma.getInstance().menu.getMainMenu()
You must cast the Menu instance to your own class if you want to use your own properties and methods:
     var menu:MyOwnMainMenu = Soma.getInstance().menu.getMainMenu() as MyOwnMainMenu;
     menu.myMethod();
     
Here is how to register a second menu (you must at least extend com.soma.view.Menu and, for the main menu, implement com.soma.interfaces.Imenu):
     Soma.getInstance().registerClass(MySecondMenuClass);
     mySprite.addChild(Soma.getInstance().menu.add("MySecondMenuClass"));
  

See also

Soma
Menu
IMenu
MenuEvent
PageManager


Public Methods
 MethodDefined by
  
Creates a MenuManager instance, the global MenuManager instance is accessible using Soma.getInstance().menu.
MenuManager
  
add(menuClass:String):Menu
Adds a menu to the MenuManager using its class name.
MenuManager
  
Get the main menu registered (the main menu class is the one registered in the Config class: Soma.getInstance().config.menuClassName).
MenuManager
  
getMenu(menuClass:String):Menu
Get a registered menu using its class name.
MenuManager
  
getMenus():Dictionary
Get all the menus.
MenuManager
Constructor detail
MenuManager()constructor
public function MenuManager()

Creates a MenuManager instance, the global MenuManager instance is accessible using Soma.getInstance().menu.

Method detail
add()method
public function add(menuClass:String):Menu

Adds a menu to the MenuManager using its class name. The menu class must registered first in Soma: Soma.getInstance().registerClass(MyMenu).

Parameters
menuClass:String — Name of the menu class (for example, the name for a com.project.menu.MyMenu class is MyMenu).

Returns
Menu — A Menu class instance (Menu should be the super class of your own menu).
getMainMenu()method 
public function getMainMenu():Menu

Get the main menu registered (the main menu class is the one registered in the Config class: Soma.getInstance().config.menuClassName).

Returns
Menu — A Menu instance (Menu should be the super class of your own menu).
getMenu()method 
public function getMenu(menuClass:String):Menu

Get a registered menu using its class name.

Parameters
menuClass:String — Class name of the menu.

Returns
Menu — A Menu instance (Menu should be the super class of your own menu).
getMenus()method 
public function getMenus():Dictionary

Get all the menus.

Returns
Dictionary — A Dictionary.