preload images with jsb

preload images with jsb
0.0 0


is it possible to preload images from url using jsb? i work with cocos2d-x v2.3.
i found the js function cc.Loader.preload but it just calls the callback without any loading.
Thank you.



That’s because, image don’t need to be preloaded in JSB, all JSB resources should be put in the project package.


i need avatar images from the server because the game is user against user. is there a possibility to load such images?


Hi, we have bind Cocos2d-x’s AssetsManager class, you can use it to download online images and manager its version etc.
Sorry we don’t have a use doc, but you can refer to the Cocos2d-x API and test-case. We will produce a document very soon



APIs are listed below

cc.AssetsManager.create(packageUrl, versionFileUrl, storagePath, errorCallback, progressCallback, successCallback);
bool cc.AssetsManager.prototype.checkUpdate()
String cc.AssetsManager.prototype.getStoragePath()
String cc.AssetsManager.prototype.getPackageUrl()
int cc.AssetsManager.prototype.getConnectionTimeout()
String cc.AssetsManager.prototype.getVersion()
String cc.AssetsManager.prototype.getVersIonFileUrl()


i just checked the documentation. i have some questions.
what is packageUrl ?
what is versionFileUrl ?
do you have an example for loading 2 files?
I took a look into jsb_cocos2dx_extension_auto_api.js and all the above functions are empty? (version 3.0alpha2)
Thank you



The jsb_cocos2dx_extension_auto_api.js is just for reminding APIs, the real implementation is in JSB: jsb_cocos2dx_extension_auto.hpp and jsb_cocos2dx_extension_auto.cpp


Sorry for the AssetsManager, we haven’t a test case yet, and its API is not stable, we are planning to refactor it to make it more flexible. We will add some samples by then