Added compatible functions for HTML5 multi resources preloading.

This commit is contained in:
linshun 2013-03-07 15:49:05 +08:00
parent b06380432b
commit d60ba89b36
1 changed files with 19 additions and 0 deletions

View File

@ -537,3 +537,22 @@ cc.ScrollView.extend = cc.Class.extend;
cc.TableView.extend = cc.Class.extend;
cc.TableViewCell.extend = cc.Class.extend;
// Cocos2d-html5 supports multi scene resources preloading.
// This is a compatible function for JSB.
cc.Loader = cc.Class.extend({
initWith:function (resources, selector, target) {
if (selector) {
this._selector = selector;
this._target = target;
}
this._selector.call(this._target);
}
});
cc.Loader.preload = function (resources, selector, target) {
if (!this._instance) {
this._instance = new cc.Loader();
}
this._instance.initWith(resources, selector, target);
return this._instance;
};