cocos creator学习笔记之loadResDir资源加载和调用
官文给的是
// load the texture (resources/imgs/cocos.png) and the corresponding sprite frame
cc.loader.loadResDir('imgs/cocos', function (err, assets) {
if (err) {
cc.error(err);
return;
}
var texture = assets[0];
var spriteFrame = assets[1];
});
// load all textures in "resources/imgs/"
cc.loader.loadResDir('imgs', cc.Texture2D, function (err, textures) {
var texture1 = textures[0];
var texture2 = textures[1];
});
// load all JSONs in "resources/data/"
cc.loader.loadResDir('data', function (err, objects, urls) {
var data = objects[0];
var url = urls[0];
});
