Cocos Creator button touch listener (javascript)

Hi, today I am sharing cocos creator touch listener method. In creator, there is node.on() method to handle events.

/* button */
var button = cc.find("Canvas/Button")

if(button) {
    button.on(cc.Node.EventType.TOUCH_START, function () {
        // your codes.
    }, button)

2 Replies to “Cocos Creator button touch listener (javascript)”

Leave a Reply

Your email address will not be published. Required fields are marked *