Packagesekati.ui
Classpublic class ContextualMenu
InheritanceContextualMenu Inheritance flash.events.EventDispatcher

ContextualMenu provides a common ContextMenu interface.



Public Properties
 PropertyDefined by
  builtInItems : Boolean
Return the ContextualMenu.builtInItems state.
ContextualMenu
  enabled : Boolean
Return the ContextualMenu enabled state.
ContextualMenu
Protected Properties
 PropertyDefined by
  _backup : Array
ContextualMenu
  _hasBuiltInItems : Boolean
ContextualMenu
  _isEnabled : Boolean
ContextualMenu
  _items : Array
ContextualMenu
  _target : DisplayObject
ContextualMenu
Public Methods
 MethodDefined by
  
ContextualMenu(target:DisplayObject, hasBuiltInItems:Boolean = false, enable:Boolean = true)
ContextualMenu Constructor
ContextualMenu
  
addItem(caption:String, cb:Function = null, div:Boolean = true, enable:Boolean = true):Number
Add a new item to the ContextualMenu.
ContextualMenu
  
destroy():void
Cleanly destroy the ContextMenu.
ContextualMenu
  
disableItem(id:Number):void
Disable an existing item in the ContextualMenu
ContextualMenu
  
editItem(id:Number, caption:String, cb:Function = null, div:Boolean = true, enable:Boolean = true):void
Edit an existing ContextualMenu item.
ContextualMenu
  
enableItem(id:Number):void
Enable an existing item in the ContextualMenu
ContextualMenu
  
getItemId(caption:String, allowFuzzyMatch:Boolean = false):Number
Returns the ContextualMenu item id that matches the caption arguments caption.
ContextualMenu
  
removeItem(id:Number):void
Remove an item from the Context Menu
ContextualMenu
Protected Methods
 MethodDefined by
  
buildMenu():void
Build the custom ContextualMenu.
ContextualMenu
  
voidClick(e:ContextMenuEvent):void
Void function assigned to added items without callback.
ContextualMenu
Property detail
_backupproperty
protected var _backup:Array
builtInItemsproperty 
builtInItems:Boolean  [read-write]

Return the ContextualMenu.builtInItems state.

Implementation
    public function get builtInItems():Boolean
    public function set builtInItems(value:Boolean):void
enabledproperty 
enabled:Boolean  [read-write]

Return the ContextualMenu enabled state.

Implementation
    public function get enabled():Boolean
    public function set enabled(value:Boolean):void
_hasBuiltInItemsproperty 
protected var _hasBuiltInItems:Boolean
_isEnabledproperty 
protected var _isEnabled:Boolean
_itemsproperty 
protected var _items:Array
_targetproperty 
protected var _target:DisplayObject
Constructor detail
ContextualMenu()constructor
public function ContextualMenu(target:DisplayObject, hasBuiltInItems:Boolean = false, enable:Boolean = true)

ContextualMenu Constructor

Parameters
target:DisplayObject
 
hasBuiltInItems:Boolean (default = false)
 
enable:Boolean (default = true)
Method detail
addItem()method
public function addItem(caption:String, cb:Function = null, div:Boolean = true, enable:Boolean = true):Number

Add a new item to the ContextualMenu.

Parameters
caption:String — item caption (must be a unique string).
 
cb:Function (default = null) — item callback function fired when the item is selected.
 
div:Boolean (default = true) — item has a divider seperating it from the items above.
 
enable:Boolean (default = true) — item interactivity enabled.

Returns
Number — Number ContextualMenu item id.
buildMenu()method 
protected function buildMenu():void

Build the custom ContextualMenu.

destroy()method 
public function destroy():void

Cleanly destroy the ContextMenu.

disableItem()method 
public function disableItem(id:Number):void

Disable an existing item in the ContextualMenu

Parameters
id:Number — of the item to be disabled.

Throws
— if invalid item id was passed.
editItem()method 
public function editItem(id:Number, caption:String, cb:Function = null, div:Boolean = true, enable:Boolean = true):void

Edit an existing ContextualMenu item.

Parameters
id:Number — of the existing item to be edited.
 
caption:String — item caption.
 
cb:Function (default = null) — item callback function fired when the item is selected.
 
div:Boolean (default = true) — item has a divider seperating it from the items above.
 
enable:Boolean (default = true) — item interactivity enabled.

Throws
— if invalid item id was passed.
enableItem()method 
public function enableItem(id:Number):void

Enable an existing item in the ContextualMenu

Parameters
id:Number — of the item to be enabled.

Throws
— if invalid item id was passed.
getItemId()method 
public function getItemId(caption:String, allowFuzzyMatch:Boolean = false):Number

Returns the ContextualMenu item id that matches the caption arguments caption.

Parameters
caption:String — the ContextualMenu item's caption.
 
allowFuzzyMatch:Boolean (default = false) — if true the 1st fuzzy match (e.g. the 1st item which contains the caption argument will be returned), if false an absolute match will be sought out.

Returns
Number — Number the ContextualMenu item id or NaN if no match was found.
removeItem()method 
public function removeItem(id:Number):void

Remove an item from the Context Menu

Parameters
id:Number — the caption name of the item to be removed

Throws
— if invalid item id was passed.
voidClick()method 
protected function voidClick(e:ContextMenuEvent):void

Void function assigned to added items without callback.

Parameters
e:ContextMenuEvent