Function is called once but it keeps getting called?

HI,

I’m trying to figure out why cc.info(‘Added button event’); is called repeatedly but it had only been called once.

When I remove this part of the code (see below), it works normally, I only see ‘Added button event’ ran once.

 start () {
        this.AddButtonEvent();
        
    },

    // update (dt) {},

    AddButtonEvent: function (){

        cc.info('Added button event');
        
        //PART TO REMOVE
        checkWinSizeButton.node.on(cc.Node.EventType.TOUCH_START, function(event){
            cc.info('This is a callback after the trigger event');
        }); 
        //END OF PART TO REMOVE
    },

called once, as expected.

Gets called repeatedly, why?

Let me ask a member of the engineering team to look into this.

Can you give me a demo?

Please open scene Card13.

start_project copy.zip (597.5 KB)

Thanks. @knox will look at this when he can.

I tested it in the latest version of 1.7. What’s your creator version?

v1.7.0 running on a mac.
28 AM

What macOS version are you running? Any special Locale?

Here is the mac info
01 AM

Locale is en_HK.

image

I found the reason, your code error, less this.checkWinSizeButton