Jump to content

Sprite onInputOut dispatching in touchscreen


Recommended Posts

Iorana! I have just a little question about onInputOut behaivour in mobile/touch devices.

I have this scenario in Phaser 2.6.2: A small lovely Sprite with inputEnabled activated to handle events, connected with events.onInputOver and events.onInputOut, just for hover actions. No problems there. 

If I test it in desktop, the signals are dispatched correctly if I move the mouse over the sprite and then move it away from it. But in mobile/touch the behaivour is different. Obviously, you can't "move" a touch Pointer like a mouse, but anyways if you tap the sprite events.onInputOver is dispatched. BUT, after that, if you tap other place somewhere in the screen there's not any events.onInputDown signal, resulting the game acting if there's still hovering the sprite. But keeping pressed the touchscreen and move Pointer it dispatch the desired signal.

I know one can make workaround to handle this (if it is mobile check in the next tap, if the pointer is inside bounds of the sprite: If not, manually dispatch events.onInputOut signal), but I have the doubt in mind if this is the correct behaivour of the signal or not. (Probably not, but there's always a bug possiblity). I checked the docs and there's not much thing to say about the event:



This signal is dispatched if the Game Object has inputEnabled set to true,
and receives an out event from a Phaser.Pointer, which was previously over it.
It is sent two arguments:
{any} The Game Object that received the event.
{Phaser.Pointer} The Phaser.Pointer object that caused the event.

As yoy can see, the docs don't cover this particular case. If someone explains me this well if this must be work or not...

Thanks in advance :)

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...