Hi there!
When I create a sprite in a function in a separate file and add an event to it, nothing works:
Code
var back = this.add.sprite(options_overlay.width/2-(width/2), options_overlay.height/2, 'back-button');
back.inputEnabled = true;
back.events.onInputDown.add(back_down, this);
back.events.onInputOver.add(back_over, this);
back.events.onInputOut.add(back_out, this);
function back_down() {
console.log('back_down');
}
function back_over(button) {
console.log('back_over');
}
function back_out(button) {
console.log('back_out');
}
Where is my problem? Thx!