Class cc.MenuItemLabel

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.MenuItemLabel(label, selector, target)
Any cc.Node that supports the cc.LabelProtocol protocol can be added.

Method Summary

Class Detail

cc.MenuItemLabel(label, selector, target)
Any cc.Node that supports the cc.LabelProtocol protocol can be added.
Supported nodes:
- cc.BitmapFontAtlas
- cc.LabelAtlas
- cc.LabelTTF
var menuitemLabel = new cc.MenuItemLabel(label,selector,target);
Parameters:
{cc.Node} label
{function|String} selector
{cc.Node} target

Field Detail

{cc.Color} disabledColor
- Color of label when it's diabled
{cc.Node} label
- Label of label item
{String} string
- Content string of label item

Method Detail

  • activate()
    activate the menu item
  • <static> {cc.MenuItemLabel} cc.MenuItemLabel.create(label, selector, target)
    Parameters:
    {cc.Node} label
    {function|String|Null} selector Optional
    {cc.Node|Null} target Optional
    Deprecated:
    since v3.0 ,please use new cc.MenuItemLabel(label,selector,target) instead
    Returns:
    {cc.MenuItemLabel}
  • ctor(label, selector, target)
    Constructor of cc.MenuItemLabel
    Parameters:
    {cc.Node} label
    {function|String} selector
    {cc.Node} target
  • {cc.Color} getColor()
    return the color of cc.MenuItemLabel
    Returns:
    {cc.Color}
  • {cc.Color} getDisabledColor()
    return the disable color for this cc.MenuItemLabel
    Returns:
    {cc.Color}
  • {cc.Node} getLabel()
    return label of cc.MenuItemLabel
    Returns:
    {cc.Node}
  • {Number} getOpacity()
    return the opacity of cc.MenuItemLabel
    Returns:
    {Number}
  • {*|string|_p.string|ret.string|q.string|String} getString()
    return the string of cc.MenuItemLabel
    Returns:
    {*|string|_p.string|ret.string|q.string|String}
  • {Boolean} initWithLabel(label, selector, target)
    initializes a cc.MenuItemLabel with a label
    Parameters:
    {cc.Node} label
    {function|String} selector
    {cc.Node} target
    Returns:
    {Boolean}
  • selected()
    menu item is selected (runs callback)
  • setColor(color)
    set the opacity for cc.MenuItemLabel
    Parameters:
    {cc.Color} color
  • setDisabledColor(color)
    set the disable color for this cc.MenuItemLabel
    Parameters:
    {cc.Color} color
  • setEnabled(enabled)
    set enable value to cc.MenuItemLabel
    Parameters:
    {Boolean} enabled
  • setLabel(label)
    set a label for cc.MenuItemLabel
    Parameters:
    {cc.Node} label
  • setOpacity(opacity)
    set opacity for cc.MenuItemLabel
    Parameters:
    {Number} opacity
    from 0-255
  • setString(label)
    set the string for cc.MenuItemLabel
    Parameters:
    {String} label
  • unselected()
    menu item goes back to unselected state