Class cc.MenuItemToggle
Extends
cc.MenuItem.
Defined in: CCMenuItem.js.
Constructor Attributes | Constructor Name and Description |
---|---|
A simple container class that "toggles" it's inner items
The inner items can be any MenuItem |
Field Attributes | Field Name and Description |
---|---|
this identifies this class implements RGBAProtocol methods
|
Method Attributes | Method Name and Description |
---|---|
activate()
activate the menu item
|
|
addSubItem(item)
|
|
<static> |
cc.MenuItemToggle.create()
create a simple container class that "toggles" it's inner items
The inner items can be any MenuItem |
getColor()
|
|
similar to get children
|
|
initWithItems(args[last-1], args[last])
|
|
onEnter()
|
|
selected()
menu item is selected (runs callback)
|
|
returns the selected item
|
|
setColor(Color)
|
|
setEnabled(enabled)
|
|
setOpacity(Opacity)
|
|
setOpacityModifyRGB(value)
|
|
setSelectedIndex(SelectedIndex)
|
|
setSubItems(SubItems)
|
|
menu item goes back to unselected state
|
- Methods borrowed from class cc.MenuItem:
- initWithCallback, isEnabled, isSelected, rect, setCallback, setTarget
- Methods borrowed from class cc.Node:
- addChild, cleanup, convertToNodeSpace, convertToNodeSpaceAR, convertTouchToNodeSpace, convertTouchToNodeSpaceAR, convertToWorldSpace, convertToWorldSpaceAR, ctor, description, draw, getActionByTag, getActionManager, getAnchorPoint, getAnchorPointInPoints, getBoundingBox, getBoundingBoxToWorld, getCamera, getChildByTag, getChildren, getChildrenCount, getContentSize, getGLServerState, getGrid, getOrderOfArrival, getParent, getPosition, getPositionX, getPositionY, getRotation, getScale, getScaleX, getScaleY, getScheduler, getShaderProgram, getSkewX, getSkewY, getTag, getUserData, getUserObject, getVertexZ, getZOrder, ignoreAnchorPointForPosition, init, isIgnoreAnchorPointForPosition, isRunning, isVisible, nodeToParentTransform, nodeToWorldTransform, numberOfRunningActions, onEnterTransitionDidFinish, onExit, onExitTransitionDidStart, parentToNodeTransform, pauseSchedulerAndActions, release, removeAllChildren, removeAllChildrenWithCleanup, removeChild, removeChildByTag, removeFromParent, removeFromParentAndCleanup, reorderChild, resumeSchedulerAndActions, retain, runAction, schedule, scheduleOnce, scheduleUpdate, scheduleUpdateWithPriority, setActionManager, setAnchorPoint, setContentSize, setGLServerState, setGrid, setNodeDirty, setOrderOfArrival, setParent, setPosition, setPositionX, setPositionY, setRotation, setScale, setScaleX, setScaleY, setScheduler, setShaderProgram, setSkewX, setSkewY, setTag, setUserData, setUserObject, setVertexZ, setVisible, setZOrder, sortAllChildren, stopAction, stopActionByTag, stopAllActions, transform, transformAncestors, unschedule, unscheduleAllCallbacks, unscheduleUpdate, update, updateTransform, visit, worldToNodeTransform
Class Detail
cc.MenuItemToggle()
A simple container class that "toggles" it's inner items
The inner items can be any MenuItem
The inner items can be any MenuItem
Field Detail
RGBAProtocol
this identifies this class implements RGBAProtocol methods
Method Detail
activate()
activate the menu item
addSubItem(item)
- Parameters:
- {cc.MenuItem} item
<static>
{cc.MenuItemToggle}
cc.MenuItemToggle.create()
create a simple container class that "toggles" it's inner items
The inner items can be any MenuItem
The inner items can be any MenuItem
// Example //create a toggle item with 2 menu items (which you can then toggle between them later) var toggler = cc.MenuItemToggle.create(this, this.callback, cc.MenuItemFont.create("On"), cc.MenuItemFont.create("Off")) //Note: the first param is the target, the second is the callback function, afterwards, you can pass in any number of menuitems //if you pass only 1 variable, then it must be a cc.MenuItem var notYetToggler = cc.MenuItemToggle.create(cc.MenuItemFont.create("On"));//it is useless right now, until you add more stuff to it notYetToggler.addSubItem(cc.MenuItemFont.create("Off")); //this is useful for constructing a toggler without a callback function (you wish to control the behavior from somewhere else)
- Returns:
- {cc.MenuItemToggle}
{cc.Color3B}
getColor()
- Returns:
- {cc.Color3B}
{Number}
getOpacity()
- Returns:
- {Number}
{Number}
getSelectedIndex()
- Returns:
- {Number}
{cc.MenuItem}
getSubItems()
similar to get children
- Returns:
- {cc.MenuItem}
{Boolean}
initWithItems(args[last-1], args[last])
- Parameters:
- {cc.MenuItem} args[0...last-2]
- the rest in the array are cc.MenuItems
- {function|String} args[last-1]
- the second item in the args array is the callback
- {cc.Node} args[last]
- the first item in the args array is a target
- Returns:
- {Boolean}
isOpacityModifyRGB()
onEnter()
selected()
menu item is selected (runs callback)
{cc.MenuItem}
selectedItem()
returns the selected item
- Returns:
- {cc.MenuItem}
setColor(Color)
- Parameters:
- {cc.Color3B} Color
setEnabled(enabled)
- Parameters:
- {Boolean} enabled
setOpacity(Opacity)
- Parameters:
- {Number} Opacity
setOpacityModifyRGB(value)
- Parameters:
- value
setSelectedIndex(SelectedIndex)
- Parameters:
- {Number} SelectedIndex
setSubItems(SubItems)
- Parameters:
- {cc.MenuItem} SubItems
unselected()
menu item goes back to unselected state