Class cc.MenuItemSprite
Extends
cc.MenuItem.
Defined in: CCMenuItem.js.
Constructor Attributes | Constructor Name and Description |
---|---|
CCMenuItemSprite accepts CCNode
|
Field Attributes | Field Name and Description |
---|---|
identifies that this class implements RGBAProtocol methods
|
Method Attributes | Method Name and Description |
---|---|
<static> |
cc.MenuItemSprite.create(normal, selected, three, four, five)
create a menu item from sprite
|
getColor()
|
|
initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, selector, target)
|
|
selected()
menu item is selected (runs callback)
|
|
setColor(color)
|
|
setDisabledImage(disabledImage)
|
|
setEnabled(bEnabled)
|
|
setNormalImage(normalImage)
|
|
setOpacity(opacity)
|
|
setOpacityModifyRGB(value)
|
|
setSelectedImage(selectedImage)
|
|
menu item goes back to unselected state
|
- Methods borrowed from class cc.MenuItem:
- activate, 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, onEnter, 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.MenuItemSprite()
CCMenuItemSprite accepts CCNode objects as items.
The images has 3 different states:
- unselected image
- selected image
- disabled image
The images has 3 different states:
- unselected image
- selected image
- disabled image
Field Detail
RGBAProtocol
identifies that this class implements RGBAProtocol methods
Method Detail
<static>
{cc.MenuItemSprite}
cc.MenuItemSprite.create(normal, selected, three, four, five)
create a menu item from sprite
// Example var item = cc.MenuItemSprite.create(normalImage)//create a menu item from a sprite with no functionality var item = cc.MenuItemSprite.create(normalImage, selectedImage)//create a menu Item, nothing will happen when clicked var item = cc.MenuItemSprite.create(normalImage, SelectedImage, disabledImage)//same above, but with disabled state image var item = cc.MenuItemSprite.create(normalImage, SelectedImage, 'callback', targetNode)//create a menu item, when clicked runs targetNode.callback() var item = cc.MenuItemSprite.create(normalImage, SelectedImage, disabledImage, targetNode.callback, targetNode) //same as above, but with disabled image, and passing in callback function
- Parameters:
- {Image} normal
- normal state image
- {Image|Null} selected
- selected state image
- {Image|cc.Node|Null} three
- disabled state image OR target node
- {String|function|cc.Node|Null} four
- callback function name in string or actual function, OR target Node
- {String|function|Null} five
- callback function name in string or actual function
- Returns:
- {cc.MenuItemSprite}
{cc.Color3B}
getColor()
- Returns:
- {cc.Color3B}
{cc.Sprite}
getDisabledImage()
- Returns:
- {cc.Sprite}
{cc.Node}
getNormalImage()
- Returns:
- {cc.Node}
{Number}
getOpacity()
- Returns:
- {Number} opacity from 0 - 255
{cc.Node}
getSelectedImage()
- Returns:
- {cc.Node}
{Boolean}
initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, selector, target)
- Parameters:
- {cc.Sprite} normalSprite
- {cc.Sprite} selectedSprite
- {cc.Sprite} disabledSprite
- {function|String} selector
- {cc.Node} target
- Returns:
- {Boolean}
isOpacityModifyRGB()
selected()
menu item is selected (runs callback)
setColor(color)
- Parameters:
- {cc.Color3B} color
setDisabledImage(disabledImage)
- Parameters:
- {cc.Sprite} disabledImage
setEnabled(bEnabled)
- Parameters:
- {Boolean} bEnabled
setNormalImage(normalImage)
- Parameters:
- {cc.Node} normalImage
setOpacity(opacity)
- Parameters:
- {Number} opacity
- 0 - 255
setOpacityModifyRGB(value)
- Parameters:
- value
setSelectedImage(selectedImage)
- Parameters:
- {cc.Node} selectedImage
unselected()
menu item goes back to unselected state