Class cc.MenuItem

Class Summary
Constructor Attributes Constructor Name and Description
 
Subclass cc.MenuItem (or any subclass) to create your custom cc.MenuItem objects.

Method Summary

Class Detail

cc.MenuItem()
Subclass cc.MenuItem (or any subclass) to create your custom cc.MenuItem objects.

Method Detail

  • activate()
    call the selector with target
  • <static> {cc.MenuItem} cc.MenuItem.create(callback, target)
    creates an empty menu item with target and callback
    Not recommended to use the base class, should use more defined menu item classes
    Parameters:
    {function|String} callback
    callback
    {cc.Node} target
    Returns:
    {cc.MenuItem}
  • {Boolean} initWithCallback(callback, target)
    Parameters:
    {function|String} callback
    {cc.Node} target
    Returns:
    {Boolean}
  • {Boolean} isEnabled()
    MenuItem is Enabled
    Returns:
    {Boolean}
  • {Boolean} isSelected()
    MenuItem is selected
    Returns:
    {Boolean}
  • {cc.Rect} rect()
    return rect value of cc.MenuItem
    Returns:
    {cc.Rect}
  • selected()
    same as setIsSelected(true)
  • setCallback(callback, target)
    set the callback to the menu item
    Parameters:
    {function|String} callback
    {cc.Node} target
  • setEnabled(enable)
    set enable value of MenuItem
    Parameters:
    {Boolean} enable
  • setTarget(selector, rec)
    set the target/selector of the menu item
    Parameters:
    {function|String} selector
    {cc.Node} rec
  • unselected()
    same as setIsSelected(false)