How to set swallowtouches:false officially in Cocos Creator?

How to set swallowtouches:false officially in Cocos Creator?


I could set swallowtouches:false when using cocos2d-x,
but it seems to be unavailable on recent CocosCreator.

I’d like to set touchEvent to touchNode with propagation, touched point.
But if using on or once , swallowtouches is always true.

So I use cc.EventListener and cc.eventManager to make it.

let listener1 = cc.EventListener.create({
    event: cc.EventListener.TOUCH_ONE_BY_ONE,
    swallowTouches: false,
    onTouchBegan: (touch: cc.Touch, event) => {
        return true;
    onTouchEnded: (touch: cc.Touch, event) => {
        // do something with propagation
cc.eventManager.addListener(listener1, this.touchNode);

But EventListener and eventManager are private,
and there is warn below when running.
Simulator: JS: [WARN]: The 'cc.eventManager' will be removed in v2.0, please use 'cc.EventTarget or cc.systemEvent' instead.

And not recommended to use cc.eventManager directly for Node.

So could you teach me how to set the swallowtouches:false officially?



Same question here. Does anyone know about this?


I tried looking here:
but I don’t see anything.

Let us ask @Big_Bear for help.


use event.stopPropagation to stop the event delivery.
and you can use BlockInputEvents component to stop touch event easily



Thank you for your reply.

The behavior of event.stopPropagation and BlockInputEvents are not the same with swallowtouches:false.
So could you consider that make swallowtouches selectable true/false with on method’s argument or any other way ?