Class Index | File Index

Classes


Class cc.MenuItemImage


Extends cc.MenuItemSprite.

Defined in: CCMenuItem.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.MenuItemImage accepts images as items.
Fields borrowed from class cc.MenuItemSprite:
RGBAProtocol
Method Summary
Method Attributes Method Name and Description
<static>  
cc.MenuItemImage.create(normalImage, selectedImage, three, five, five)
creates a new menu item image
 
initWithNormalImage(normalImage, selectedImage, disabledImage, selector, target)
 
sets the sprite frame for the disabled image
 
sets the sprite frame for the normal image
 
sets the sprite frame for the selected image
Methods borrowed from class cc.MenuItemSprite:
getColor, getDisabledImage, getNormalImage, getOpacity, getSelectedImage, initWithNormalSprite, isOpacityModifyRGB, selected, setColor, setDisabledImage, setEnabled, setNormalImage, setOpacity, setOpacityModifyRGB, setSelectedImage, unselected
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.MenuItemImage()
cc.MenuItemImage accepts images as items.
The images has 3 different states:
- unselected image
- selected image
- disabled image

For best results try that all images are of the same size
Method Detail
<static> {cc.MenuItemImage} cc.MenuItemImage.create(normalImage, selectedImage, three, five, five)
creates a new menu item image
// Example
var item = cc.MenuItemImage.create('normal.png', 'selected.png', gameScene, 'run')
//create a dom menu item with normal and selected state, when clicked it will run the run function from gameScene object

var item = cc.MenuItemImage.create('normal.png', 'selected.png', 'disabled.png',  gameScene, gameScene.run)
//same as above, but pass in the actual function and disabled image
Parameters:
{String} normalImage
file name for normal state
{String} selectedImage
image for selected state
{String|cc.Node} three
Disabled image OR target
{String|function|Null} five
callback function, either name in string, or pass the whole function * @param {cc.Node|String|function|Null} four cc.Node target to run callback when clicked OR the callback
five
Returns:
{cc.MenuItemImage}

{Boolean} initWithNormalImage(normalImage, selectedImage, disabledImage, selector, target)
Parameters:
normalImage
selectedImage
disabledImage
selector
target
Returns:
{Boolean}

setDisabledSpriteFrame(frame)
sets the sprite frame for the disabled image
Parameters:
{cc.SpriteFrame} frame

setNormalSpriteFrame(frame)
sets the sprite frame for the normal image
Parameters:
{cc.SpriteFrame} frame

setSelectedSpriteFrame(frame)
sets the sprite frame for the selected image
Parameters:
{cc.SpriteFrame} frame

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jan 09 2013 07:51:52 GMT-0800 (PST)