Cocos2D JavaScript (edge) API Documentation

Class: Texture2D

Module
cocos
Defined In
libs/cocos2d/Texture2D.js
Extends
BObject

Public Properties

Property Defined By
Expand contentSize contentSize : Size of the texture <read-only> Texture2D
Expand data data : Base64 encoded image data <read-only> Texture2D
Expand id id : Integer <read-only>
Unique ID for this object
BObject

Public Methods

Method Defined By
Expand Texture2D new Texture2D ({[file:String],[data:Texture2D/HTMLImageElement]}) : cocos.Texture2D <constructor>

Named Arguments

  • file : String (Optional)
    The file path of the image to use as a texture
  • data : Texture2D/HTMLImageElement (Optional)
    Image data to read from

Returns

Texture2D
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 dataDidLoad dataDidLoad (data:*) : void

Arguments

  1. data :

Returns

  • void
Texture2D
Expand drawAtPoint drawAtPoint (ctx:*,point:*) : void

Arguments

  1. ctx :
  2. point :

Returns

  • void
Texture2D
Expand drawInRect drawInRect (ctx:*,rect:*) : void

Arguments

  1. ctx :
  2. rect :

Returns

  • void
Texture2D
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 or dot (.) separated path to a property

Returns

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

Returns

  • void
Texture2D
Expand get_pixelsWide get_pixelsWide () : void

Returns

  • void
Texture2D
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 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

Private Members

This class has no private members.