如果根据服务器返回的数据动态替换这些扑克牌

,这种怎么动态的替换服务端返回的牌。静态的是用Sprite做的。

我用下面的代码第一次运行可以了,然后我想替换第二张的时候不行了,第二张就干脆不出现了,后来无论替换那张牌都没效果了。不知道出现了什么问题。

var node = this.node.getChildByName(“pai_1”);
console.log(node);
var realUrl = cc.url.raw(“resources/card/card_heitao7.png”);
console.log(realUrl);
var texture = cc.textureCache.addImage(realUrl);
console.log(texture);
console.log(node.getComponent(cc.Sprite));
node.getComponent(cc.Sprite).spriteFrame.setTexture(texture);