I load all images in resources.js to let cocos preload them for me. And the code runs well.
Now I want to load images dynamic (download it then load). My code is like:
var texture = cc.TextureCache.getInstance().addImage(imgPath);
var rect = cc.rect(0, 0, texture.width, texture.height);
var frame = cc.SpriteFrame.createWithTexture(texture, rect);
I found the TextureCache addImage function runs not as expected, because through this function the texture seems to not response to scale or other transform (the pic shows but scale is failure, and the same code runs well if preload in advance through resources.js)
My cocos2d-h5’s version is 2.1.1, for some reason I can’t upgrade it now. So is my code not proper or it’s a bug in 2.1.1 , how can I fix it..
Thx for help