creator 动态远程加载图片


creator 动态远程加载图片

1
2
3
4
5
6
7
8
url = Common.s_remote_resource_url + "resources/bg/bg1.jpg";
cc.loader.load(url, (err, texture) => {
let width = this.m_bgSprite.node.width;
let height = this.m_bgSprite.node.height;
this.m_bgSprite.spriteFrame = new cc.SpriteFrame(texture);
this.m_bgSprite.node.width = width;
this.m_bgSprite.node.height = height;
});