CocosCreator笔记

CocosCreator写的日记

  • 加载远程服务器上图片
1
2
3
4
5
6
7
8
cc.loader.load(url, function(completedCount, totalCount, item){
this.sp_map.spriteFrame = new cc.SpriteFrame(item.content);
this.sp_map.node.setContentSize(item.content.width, item.content.height);
}.bind(this), function(err,result){
let t = result.getContent(url);
this.sp_map.spriteFrame = new cc.SpriteFrame(result.getContent(url));
this.sp_map.node.setContentSize(t.width, t.height);
}.bind(this))
1
this.sp_map.spriteFrame = new cc.SpriteFrame(url);