Here is the JSFiddle .
I have two events here.
game.input.onDownwhich executes some logic (generates particles in my example)textButton.events.onInputDownwhere textButton is a Phaser.Text instance of the object, which makes different logic.
The problem is this: when I click on textButton , both events fire 1 and 2 .
The question is how to prevent event 1 from firing when I click on textButton ?
Code Part:
...
//This event is fired on click anywhere event
game.input.onDown.add(particleBurst, this);
//This is Clickable text
textButton = game.add.text(game.world.width - 5, 5, "CLICK ME", fontStyle);
textButton.anchor.setTo(1, 0);
textButton.inputEnabled = true;
//This event is fired on click on text event
textButton.events.onInputDown.add(function () {
console.log("button is Clicked");
}, this, 2);
...