Cocos2D JavaScript (v0.1) API Documentation

Class: MenuItemImage

Module
cocos.nodes
Defined In
libs/cocos2d/nodes/MenuItem.js
Extends
MenuItemSprite
MenuItem that accepts image files

Public Properties

Property Defined By
Expand anchorPoint anchorPoint : geometry.Point
Anchor point for scaling and rotation. 0x0 is top left and 1x1 is bottom right
Node
Expand anchorPointInPixels anchorPointInPixels : geometry.Point
Anchor point for scaling and rotation in pixels from top left
Node
Expand boundingBox boundingBox : geometry.Rect <read-only> Node
Expand children children : cocos.nodes.Node[]
The child Nodes
Node
Expand contentSize contentSize : geometry.Size
Size of the node
Node
Expand id id : Integer <read-only>
Unique ID for this object
BObject
Expand parent parent : cocos.nodes.Node
Parent node
Node
Expand position position : geometry.Point
Position relative to parent node
Node
Expand rect rect : geometry.Rect <read-only> MenuItem
Expand rotation rotation : Float
Rotation angle in degrees
Node
Expand scale scale : Float Node
Expand scaleX scaleX : Float
X scale factor
Node
Expand scaleY scaleY : Float
Y scale factor
Node
Expand tag tag : *
Unique tag to identify the node
Node
Expand visible visible : boolean
Is the node visible
Node
Expand visibleRect visibleRect : geometry.Rect <read-only>
The area of the node currently visible on screen. Returns an rect even if visible is false.
Node
Expand worldBoundingBox worldBoundingBox : geometry.Rect <read-only> Node
Expand zOrder zOrder : Integer
Nodes Z index. i.e. draw order
Node

Public Methods

Method Defined By
Expand MenuItemImage new MenuItemImage ({normalImage:String,selectedImage:String,disabledImage:String}) : cocos.nodes.MenuItemImage <constructor>
MenuItem that accepts image files

Named Arguments

  • normalImage : String
    Main image file to draw
  • selectedImage : String
    Image file to draw when menu item is selected
  • disabledImage : String
    Image file to draw when menu item is disabled

Returns

MenuItemImage
Expand activate activate () : void

Returns

  • void
MenuItem
Expand addChild addChild ({child:cocos.nodes.Node,[z:Integer],[tag:Integer/String]}) : cocos.nodes.Node
Add a child Node

Named Arguments

  • The child node to add
  • z : Integer (Optional)
    Z Index for the child
  • tag : Integer/String (Optional)
    A tag to reference the child with

Returns

Node
Expand bindTo bindTo (key:String,target:BOject,[targetKey:String],[noNotify:Boolean]) : void
Bind the value of a property on this object to that of another object so they always have the same value. Setting the value on either object will update the other too.

Arguments

  1. key : String
    Name of the property on this object that should be bound
  2. target : BOject
    Object to bind to
  3. targetKey : String (Optional)
    Key on the target object to bind to
  4. noNotify : Boolean (Optional)
    Set to true to prevent this object's property triggering a 'changed' event when adding the binding

Returns

  • void
BObject
Expand changed changed (key:*) : void

Arguments

  1. key :

Returns

  • void
BObject
Expand cleanup cleanup () : void

Returns

  • void
Node
Expand convertToNodeSpace convertToNodeSpace (worldPoint:*) : void

Arguments

  1. worldPoint :

Returns

  • void
Node
Expand detatchChild detatchChild (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand draw draw (ctx:*) : void

Arguments

  1. ctx :

Returns

  • void
MenuItemSprite
Expand get get (key:String) : *
Get a property from the object. Always use this instead of trying to access the property directly. This will ensure all bindings, setters and getters work correctly.

Arguments

  1. key : String
    Name of property to get

Returns

  • *
    Value of the property
BObject
Expand getChild getChild (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand nodeToParentTransform nodeToParentTransform () : void

Returns

  • void
Node
Expand nodeToWorldTransform nodeToWorldTransform () : void

Returns

  • void
Node
Expand parentToNodeTransform parentToNodeTransform () : void

Returns

  • void
Node
Expand pauseSchedulerAndActions pauseSchedulerAndActions () : void

Returns

  • void
Node
Expand removeChild removeChild (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand reorderChild reorderChild (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand resumeSchedulerAndActions resumeSchedulerAndActions () : void

Returns

  • void
Node
Expand runAction runAction (action:*) : void

Arguments

  1. action :

Returns

  • void
Node
Expand scheduleUpdate scheduleUpdate (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand set set (key:String,value:*) : void
Set a property on the object. Always use this instead of trying to access the property directly. This will ensure all bindings, setters and getters work correctly.

Arguments

  1. key : String
    Name of property to get
  2. value : *
    New value for the property

Returns

  • void
BObject
Expand setValues setValues (kvp:Object) : void
Set multiple propertys in one go

Arguments

  1. kvp : Object
    An Object where the key is a property name and the value is the value to assign to the property

Returns

  • void
BObject
Expand stopAllActions stopAllActions () : void

Returns

  • void
Node
Expand transform transform (context:*) : void

Arguments

  1. context :

Returns

  • void
Node
Expand unbind unbind (key:String) : void
Remove binding from a property which set setup using BObject#bindTo.

Arguments

  1. key : String
    Name of the property on this object to unbind

Returns

  • void
BObject
Expand unbindAll unbindAll () : void
Remove all bindings on this object

Returns

  • void
BObject
Expand unscheduleAllSelectors unscheduleAllSelectors () : void

Returns

  • void
Node
Expand visit visit (context:*,rect:*) : void

Arguments

  1. context :
  2. rect :

Returns

  • void
Node
Expand worldToNodeTransform worldToNodeTransform () : void

Returns

  • void
Node

Public Events

Event Defined By
Expand onEnter onEnter () : void
Triggered when the node is added to a scene

Returns

  • void
Node
Expand onExit onExit () : void
Triggered when the node is removed from a scene

Returns

  • void
Node

Private Members

This class has no private members.