游戏中做了一个弹出层, 但是点击弹出层,会穿透,点到下面舞台上的文本编辑框和按钮.
在弹出层上添加了
onEnable: function () {
cc.log('onEnable');
this.node.on('touchstart', function (event) {
event.stopPropagation();
});
this.node.on('touchend', function (event) {
event.stopPropagation();
});
},
onDisable: function () {
cc.log('onDisable');
this.node.off('touchstart', function (event) {
event.stopPropagation();
});
this.node.off('touchend', function (event) {
event.stopPropagation();
});
},
运行,onEnable有输出.
但是点击还是穿透下去了.
这个问题求问啊各位大神
我现在处理的是 手动添加一个空的button做背景来阻止点击,但是感觉这好傻~~~~~~~~~