Class Index | File Index

Classes


Class cc.Loader


Extends cc.Class.

Defined in: CCLoader.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
A class to pre-load resources before engine start game main loop.
Field Summary
Field Attributes Field Name and Description
 
status when res loading error
 
status when resources loading success
 
status when res loading
Method Summary
Method Attributes Method Name and Description
<static>  
cc.Loader.getInstance()
Share Loader
 
For loading percentage You can use this method to create a custom loading screen.
 
Check the loading status
 
Callback when a resource file loaded.
 
Callback when loading resource error
 
preload(res)
Pre-load the resources before engine start game main loop.
Class Detail
cc.Loader()
A class to pre-load resources before engine start game main loop.
Field Detail
onerror
status when res loading error
//example
cc.Loader.getInstance().onerror = function () {
     //do something
};

onload
status when resources loading success
 //example
cc.Loader.getInstance().onload = function () {
     cc.AppController.shareAppController().didFinishLaunchingWithOptions();
};

onloading
status when res loading
//example
cc.Loader.getInstance().onloading = function () {
      cc.LoaderScene.getInstance().draw();
};
Method Detail
<static> {cc.Loader} cc.Loader.getInstance()
Share Loader
Returns:
{cc.Loader}

{Number} getProgressBar()
For loading percentage You can use this method to create a custom loading screen.
//example
cc.log(cc.Loader.getInstance().getProgressBar() + "%");
Returns:
{Number}

isLoadedComplete()
Check the loading status

onResLoaded()
Callback when a resource file loaded.
//example
cc.Loader.getInstance().onResLoaded();

onResLoadingErr(name)
Callback when loading resource error
//example
cc.Loader.getInstance().onResLoadingErr(name);
Parameters:
{String} name

preload(res)
Pre-load the resources before engine start game main loop. There will be some error without pre-loading resources.
//example
var res = [
              {type:"image", src:"hello.png"},
              {type:"tmx", src:"hello.tmx"}
    ]
cc.Loader.getInstance().preload(res);
Parameters:
{object} res

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jan 09 2013 07:51:52 GMT-0800 (PST)