lukaMis Posted May 4, 2015 Share Posted May 4, 2015 Hi I have game.input.onDown and mySprite.events.onInputDown listeners in game. I add listener for on game later than on sprite but listener for game triggers before event on sprite. Is there any way i can manipulate event flow. Similar to what we have in DOM events (event.targetevent.currentTargetevent.preventDefault()event.stopPropagation()) Can i stop event in game listener (if sprite was clicked too) or force event to trigger on sprite first under some condition? Link to comment Share on other sites More sharing options...
MichaelD Posted May 4, 2015 Share Posted May 4, 2015 the event that is fired with the inputDown event contains info of which element was pressed you could check if the object launching the event is the global-game or your sprite and if its not the correct one do return false; Link to comment Share on other sites More sharing options...
lukaMis Posted May 4, 2015 Author Share Posted May 4, 2015 @MichaelDDo you have an example perhaps? I only get target: canvastargetObject: nullfrom event on game listener. Even if i click on mySprite. There is no reference what object lies beneath.And just a side note game.input.onDown and mySprite.events.onInputDown have different callback functions. Code: this.pauseButton.events.onInputDown.add(this.pauseGame, this);this.game.input.onDown.add(this.fireButtonDown, this); Link to comment Share on other sites More sharing options...
piotr Posted October 11, 2016 Share Posted October 11, 2016 @lukaMis did you manage to solve this? Link to comment Share on other sites More sharing options...
Recommended Posts