标签:style blog color io os div sp cti 代码
if("touches" in cc.sys.capabilities){ cc.eventManager.addListener({event: cc.EventListener.TOUCH_ONE_BY_ONE, onTouchBegan: function(){ trace("func1"); return true; }}, this.child1); cc.eventManager.addListener({event: cc.EventListener.TOUCH_ONE_BY_ONE, onTouchBegan: function(touch,event){ trace("func2"); //按顺序执行,先func2,再func3 return true; }}, this.child2); cc.eventManager.addListener({event: cc.EventListener.TOUCH_ONE_BY_ONE, onTouchBegan: function(touch,event){ trace("func3"); event.stopPropagation(); return true; }}, this.child2); }else{ cc.eventManager.addListener({event: cc.EventListener.MOUSE, onMouseDown: function(){ trace("func1"); }}, this.child1); cc.eventManager.addListener({event: cc.EventListener.MOUSE, onMouseDown: function(event){ trace("func2"); //按顺序执行,先func2,再func3 }}, this.child2); cc.eventManager.addListener({event: cc.EventListener.MOUSE, onMouseDown: function(event){ trace("func3"); event.stopPropagation(); }}, this.child2); }
事件响应的优先级、stopProgapation禁止下层组件响应
标签:style blog color io os div sp cti 代码
原文地址:http://www.cnblogs.com/kenkofox/p/3974998.html