Cocos2D JavaScript (v0.1) API Documentation

Class: BArray

Module
Global
Defined In
global.js
Extends
BObject

Public Properties

Property Defined By
Expand id id : Integer <read-only>
Unique ID for this object
BObject

Public Methods

Method Defined By
Expand BArray new BArray ([array:Array]) : BArray <constructor>

Arguments

  1. array : Array (Optional)
    A normal JS array to use for data

Returns

  • New instance of BArray
BArray
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 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 getArray getArray () : Array
Get the internal Javascript Array instance

Returns

  • Array
    Internal Javascript Array
BArray
Expand getAt getAt (i:Integer) : *
Get an item

Arguments

  1. i : Integer
    Index to get item from

Returns

  • *
    Value stored in the array at index 'i'
BArray
Expand insertAt insertAt (i:Integer,value:*) : void
Insert a new item into the array without overwriting anything

Arguments

  1. i : Integer
    Index to insert item at
  2. value : *
    Value to insert

Returns

  • void
BArray
Expand pop pop () : *
Remove value from the end of the array and return it

Returns

  • *
    Value that was removed
BArray
Expand push push (value:*) : Integer
Append a value to the end of the array and return its new length

Arguments

  1. value : *
    Value to append to the array

Returns

  • Integer
    New length of the array
BArray
Expand removeAt removeAt (i:Integer) : *
Remove item from the array and return it

Arguments

  1. i : Integer
    Index to remove

Returns

  • *
    Value that was removed
BArray
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 setAt setAt (i:Integer,value:*) : void
Set an item -- Overwrites any existing item at index

Arguments

  1. i : Integer
    Index to set item to
  2. value : *
    Value to assign to index

Returns

  • void
BArray
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.