[]sprite添加texture后,sprite无法触发点击事件?


this.item.graphics.drawTexture(Laya.loader.getRes(IMG_RES[this.name]));
Laya.stage.addChild(this.item); 
this.item.on(Laya.Event.CLICK, this, () => { this.item.destroy(); });
已邀请:

cuixueying

赞同来自:

为你的sprite设置下宽高就好了!

yplpf

赞同来自:

Sprite默认是没有宽高的, 设置一下
autoSize=true 就能触发鼠标事件了

要回复问题请先

商务合作
商务合作