Cocos Creator API

0.7.1

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

loader

Module: cc

Loader for resource loading process. It's a singleton object.

Methods

loadJs
(
  • [baseDir ]
  • jsList
  • [cb ]
)

Load js files. If the third parameter doesn't exist, then the baseDir turns to be "".

name type description
baseDir optional String

The pre path for jsList or the list of js path.

jsList Array

List of js path.

cb optional Function

Callback function

returns:

type:

loadJsWithImg
(
  • [baseDir ]
  • jsList
  • [cb ]
)

Load js width loading image.

name type description
baseDir optional String
jsList Array
cb optional Function

loadTxt
(
  • url
  • [cb ]
)

Load a single resource as txt.

name type description
url String
cb optional Function

arguments are : err, txt

loadJson
(
  • url
  • [cb ]
)

Load a single resource as json.

name type description
url String
cb optional Function

arguments are : err, json

loadImg
(
  • url
  • [option ]
  • callback
)
Image

Load a single image.

name type description
url String
option optional Object
callback Function

returns:

type: Image

_loadResIterator
(
  • item
  • index
  • [cb ]
)
private

Iterator function to load res.

name type description
item Object
index Number
cb optional Function

returns:

type:

getUrl
(
  • basePath
  • [url ]
)

Get url with basePath.

name type description
basePath String
url optional String

returns:

type:

load
(
  • resources
  • [option ]
  • [loadCallback ]
)
AsyncPool

Load resources then call the callback.

name type description
resources String
option optional Function

callback or trigger

loadCallback optional Function | Object

returns:

type: AsyncPool

loadAliases
(
  • url
  • [callback ]
)

Loads alias map from the contents of a filename.

name type description
url String

The plist file name.

callback optional Function

register
(
  • extNames
  • loader
)

Register a resource loader into loader.

name type description
extNames String
loader Function

getRes
(
  • url
)

Get resource data by url.

name type description
url Unknown

returns:

type:

getAliase
(
  • url
)

Get aliase by url.

name type description
url Unknown

returns:

type:

release
(
  • url
)

Release the cache of resource by url.

name type description
url Unknown

releaseAll ( )

Resource cache of all resources.

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index