preload images with jsb

Hi,
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.

@roelfsche

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

@pandamicro,
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

Huabin

APIs are listed below

cc.AssetsManager.create(packageUrl, versionFileUrl, storagePath, errorCallback, progressCallback, successCallback);
cc.AssetsManager.prototype.setStoragePath(storagePath)
cc.AssetsManager.prototype.setPackageUrl(packageUrl)
bool cc.AssetsManager.prototype.checkUpdate()
String cc.AssetsManager.prototype.getStoragePath()
cc.AssetsManager.prototype.update()
cc.AssetsManager.prototype.setConnectionTimeout(timeout)
cc.AssetsManager.prototype.setVersionFileUrl(versionFileUrl)
String cc.AssetsManager.prototype.getPackageUrl()
int cc.AssetsManager.prototype.getConnectionTimeout()
String cc.AssetsManager.prototype.getVersion()
String cc.AssetsManager.prototype.getVersIonFileUrl()
cc.AssetsManager.prototype.deleteVersion()

@pandamicro
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

@roelfsche

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