Packagecom.ericfeminella.ui
Classpublic class ConfigurableContextMenu
ImplementsIConfigurableContextMenu

Provides a default IConfigurableContextMenu implementation which allows clients to configure a custom ContextMenu dynamically at runtime as well as add additional items, remove items and enable disable ContextMenuItems

ConfigurableContextMenu provides a "has-a" relationship in that it wraps a ContextMenu object instance in order to provide an API for working on a ContextMenu at runtime

See also

ConfigurableContextMenuBuilder.html


Protected Properties
 PropertyDefined by
  menu : ContextMenu
Defines the ContextMenu which the ConfigurableContextMenu instance wraps in order to provide an additional runtime API
ConfigurableContextMenu
Public Methods
 MethodDefined by
  
ConfigurableContextMenu(owner:InteractiveObject, menuSelectHandler:Function = null, showDefaultItems:Boolean = false)
Instantiates a new instance of ConfigurableContextMenu and sets the specified configurationsp>
ConfigurableContextMenu
  
addContextMenuItem(contextMenuItem:ContextMenuItem, listener:Function = null):Boolean
Adds a new ContextMenuItem to the ConfigurableContextMenu which contains an associated listener which handles the item when selected
ConfigurableContextMenu
  
cloneContextMenu():ContextMenu
Clones the ContextMenu object provided by the ConfigurableContextMenu instance
ConfigurableContextMenu
  
disableContextMenuItem(caption:String):void
Disables a ContextMenuItem in a ConfigurableContextMenu
ConfigurableContextMenu
  
enableContextMenuItem(caption:String):void
Enables a ContextMenuItem in a ConfigurableContextMenu
ConfigurableContextMenu
  
getContextMenuItem(caption:String):ContextMenuItem
Retrieves a specific ContextMenuItem from the ConfigurableContextMenu instance
ConfigurableContextMenu
  
Retrieves all items from a ConfigurableContextMenu instance, each item is of type CContextMenuItem
ConfigurableContextMenu
  
hasContextMenuItem(caption:String):Boolean
Determines if the current ConfigurableContectMenu instance has the specified ContextMenuItem
ConfigurableContextMenu
  
hideContextMenuItem(caption:String):void
Clones the ContextMenu of an ConfigurableContextMenu instance
ConfigurableContextMenu
  
removeContextMenuItem(caption:String):void
Removes a specific ContextMenuItem which has been added to a ConfigurableContextMenu
ConfigurableContextMenu
  
Removes all valid built-in default ContextMenuItems which are allowed to be removed from a ContextMenuItem as well as each additional ContextMenuItem which has been added
ConfigurableContextMenu
  
Removes all valid built-in default ContextMenuItems which are allowed to be removed from a ContextMenuItem
ConfigurableContextMenu
  
showContextMenuItem(caption:String):void
Clones the ContextMenu of an ConfigurableContextMenu instance
ConfigurableContextMenu
Public Constants
 ConstantDefined by
  MAXIMUM_MENU_ITEMS : uint = 15
[static] Defines the maximum allowed ContextMenuItem instances which can be added to a ContextMenu
ConfigurableContextMenu
Property detail
menuproperty
protected var menu:ContextMenu

Defines the ContextMenu which the ConfigurableContextMenu instance wraps in order to provide an additional runtime API

See also

flash.ui.ContextMenu
Constructor detail
ConfigurableContextMenu()constructor
public function ConfigurableContextMenu(owner:InteractiveObject, menuSelectHandler:Function = null, showDefaultItems:Boolean = false)

Instantiates a new instance of ConfigurableContextMenu and sets the specified configurationsp>

Parameters
owner:InteractiveObject — InteractiveObject owner in which to apply the context menu
 
menuSelectHandler:Function (default = null) — method to invoke upon menu selection
 
showDefaultItems:Boolean (default = false)
Method detail
addContextMenuItem()method
public function addContextMenuItem(contextMenuItem:ContextMenuItem, listener:Function = null):Boolean

Adds a new ContextMenuItem to the ConfigurableContextMenu which contains an associated listener which handles the item when selected

Parameters
contextMenuItem:ContextMenuItem — specifies if an item seperator is to be added, the default is false
 
listener:Function (default = null) — specifies if the item is enabled or disabled, the default is enabled

Returns
Boolean — true if the ContextMenuItem has successfully been added

Throws
 

Example
   
   var cm:IConfigurableContextMenu = new ConfigurableContextMenu( this );
   
   try 
   {
       cm.addContextMenuItem( new ContextMenuItem("Save Items") );
   }
   catch( e:ContextMenuItemCollisionException)
   {
      // handle ContextMenuItemCollisionException error...
   }
   catch( e:ContextMenuItemInvalidCaptionException)
   {
      // handle ContextMenuItemInvalidCaptionException error...
   }
   catch( e:ContextMenuMaximumItemsExceededError)
   {
      // handle ContextMenuMaximumItemsExceededError error...
   }
   
   

cloneContextMenu()method 
public function cloneContextMenu():ContextMenu

Clones the ContextMenu object provided by the ConfigurableContextMenu instance

Returns
ContextMenu — clone of the ConfigurableContextMenu ContextMenu
disableContextMenuItem()method 
public function disableContextMenuItem(caption:String):void

Disables a ContextMenuItem in a ConfigurableContextMenu

Parameters
caption:String — caption of the ContextMenuItem to disable
enableContextMenuItem()method 
public function enableContextMenuItem(caption:String):void

Enables a ContextMenuItem in a ConfigurableContextMenu

Parameters
caption:String — caption of the ContextMenuItem to enable
getContextMenuItem()method 
public function getContextMenuItem(caption:String):ContextMenuItem

Retrieves a specific ContextMenuItem from the ConfigurableContextMenu instance

Parameters
caption:String — identifier for the item which is to be retrieved

Returns
ContextMenuItem — ContextMenuItem added to a ConfigurableContextMenu

Throws
getContextMenuItems()method 
public function getContextMenuItems():Array

Retrieves all items from a ConfigurableContextMenu instance, each item is of type CContextMenuItem

Returns
Array — an Array of ContextMenuItem
hasContextMenuItem()method 
public function hasContextMenuItem(caption:String):Boolean

Determines if the current ConfigurableContectMenu instance has the specified ContextMenuItem

Parameters
caption:String — caption to use as an identifier for the item

Returns
Boolean — true if the item exists, otherwise false
hideContextMenuItem()method 
public function hideContextMenuItem(caption:String):void

Clones the ContextMenu of an ConfigurableContextMenu instance

Parameters
caption:String
removeContextMenuItem()method 
public function removeContextMenuItem(caption:String):void

Removes a specific ContextMenuItem which has been added to a ConfigurableContextMenu

Parameters
caption:String — identifier for the item which is to be removed
removeContextMenuItems()method 
public function removeContextMenuItems():void

Removes all valid built-in default ContextMenuItems which are allowed to be removed from a ContextMenuItem as well as each additional ContextMenuItem which has been added

See also

flash.ui.ContextMenu
removeDefaultItems()method 
public function removeDefaultItems():void

Removes all valid built-in default ContextMenuItems which are allowed to be removed from a ContextMenuItem

See also

flash.ui.ContextMenu
showContextMenuItem()method 
public function showContextMenuItem(caption:String):void

Clones the ContextMenu of an ConfigurableContextMenu instance

Parameters
caption:String
Constant detail
MAXIMUM_MENU_ITEMSconstant
public static const MAXIMUM_MENU_ITEMS:uint = 15

Defines the maximum allowed ContextMenuItem instances which can be added to a ContextMenu