ContextualMenu provides a common
ContextMenu
interface.
protected var _backup:Array
builtInItems:Boolean
[read-write]
Return the ContextualMenu.builtInItems
state.
Implementation
public function get builtInItems():Boolean
public function set builtInItems(value:Boolean):void
enabled:Boolean
[read-write]
Return the ContextualMenu
enabled state.
Implementation
public function get enabled():Boolean
public function set enabled(value:Boolean):void
protected var _hasBuiltInItems:Boolean
protected var _isEnabled:Boolean
protected var _items:Array
protected var _target:DisplayObject
public function ContextualMenu(target:DisplayObject, hasBuiltInItems:Boolean = false, enable:Boolean = true)
ContextualMenu Constructor
Parameters
| target:DisplayObject |
|
| hasBuiltInItems:Boolean (default = false )
|
|
| enable:Boolean (default = true )
|
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.
|
protected function buildMenu():void
Build the custom ContextualMenu
.
public function destroy():void
Cleanly destroy the ContextMenu
.
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.
|
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.
|
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.
|
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.
|
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.
|
protected function voidClick(e:ContextMenuEvent):void
Void function assigned to added items without callback.
Parameters
Copyright © 2008-2012 jason m horwitz, Sekati LLC. All Rights Reserved.