Class cc.MenuItemImage

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.MenuItemImage(normalImage, selectedImage, disabledImage, callback, target)
cc.MenuItemImage accepts images as items.

Method Summary

Class Detail

cc.MenuItemImage(normalImage, selectedImage, disabledImage, callback, target)
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
var menuItem = new cc.MenuItemImage(normalImage, selectedImage, three, four, five);
Parameters:
{string|null} normalImage
{string|null} selectedImage
{string|null} disabledImage
{function|string|null} callback
{cc.Node|null} target

Method Detail

  • <static> {cc.MenuItemImage} cc.MenuItemImage.create(normalImage, selectedImage, three, four, five)
    creates a new menu item image
    Parameters:
    {String} normalImage
    file name for normal state
    {String} selectedImage
    image for selected state
    {String|cc.Node} three
    Disabled image OR callback function
    {String|function|Null} four Optional
    callback function, either name in string or pass the whole function OR the target
    {cc.Node|String|function|Null} five Optional
    cc.Node target to run callback when clicked
    Deprecated:
    since v3.0, please use new cc.MenuItemImage(normalImage, selectedImage, three, four, five) instead.
    Returns:
    {cc.MenuItemImage}
  • ctor(normalImage, selectedImage, disabledImage, callback, target)
    Constructor of cc.MenuItemImage
    Parameters:
    {string|null} normalImage
    {string|null} selectedImage
    {string|null} disabledImage
    {function|string|null} callback
    {cc.Node|null} target
  • {boolean} initWithNormalImage(normalImage, selectedImage, disabledImage, callback, target)
    initializes a cc.MenuItemImage
    Parameters:
    {string|null} normalImage
    {string|null} selectedImage
    {string|null} disabledImage
    {function|string|null} callback
    {cc.Node|null} 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