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