I have this code.
if (cc.sys.capabilities.hasOwnProperty('touches')) {
cc.eventManager.addListener({
event: cc.EventListener.TOUCH_ALL_AT_ONCE,
onTouchesBegan:function(touches, event) {
for (var i = 0; i < touches.length; i++) {
x = touches[i].getLocationX();
y = touches[i].getLocationY();
if (any condition) {
this.exampleFunc();
}
}
}
}, this);
}
This error returned => Uncaught TypeError: this.exampleFunc is not a function.
I don’t understand this error. exampleFunc is defined. Like this
exampleFunc:function () {
cc.log("this is example function");
}
is cant call function in TouchEventListener guys help me