Skip to content

Commit ff9ba76

Browse files
committed
Merge pull request #1508 from pandamicro/develop
#1507: [JSB] Refactor addImageAsync to support remote image loading
2 parents 9b226d5 + 2a124b5 commit ff9ba76

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

frameworks/js-bindings/bindings/script/jsb_boot.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,11 @@ cc.loader = {
574574
});
575575
}
576576
else {
577-
var tex = cc.textureCache._addImage(url);
578-
if (tex instanceof cc.Texture2D)
579-
cb && cb(null, tex);
580-
else cb && cb("Load image failed");
577+
cc.textureCache._addImageAsync(url, function (tex){
578+
if (tex instanceof cc.Texture2D)
579+
cb && cb(null, tex);
580+
else cb && cb("Load image failed");
581+
});
581582
}
582583
},
583584
/**
@@ -932,8 +933,8 @@ cc.configuration = cc.Configuration.getInstance();
932933
* cc.textureCache is the global cache for cc.Texture2D
933934
*/
934935
cc.textureCache = cc.director.getTextureCache();
935-
cc.TextureCache.prototype._addImage = cc.TextureCache.prototype.addImage;
936-
cc.TextureCache.prototype.addImage = function(url, cb, target) {
936+
cc.TextureCache.prototype._addImageAsync = cc.TextureCache.prototype.addImageAsync;
937+
cc.TextureCache.prototype.addImageAsync = function(url, cb, target) {
937938
var localTex = null;
938939
cc.loader.loadImg(url, function(err, tex) {
939940
if (err) tex = null;

0 commit comments

Comments
 (0)