Jump to content

Sprite.Events.OnDown fired twice in Android Stock Browser


Hsaka
 Share

Recommended Posts

Hello, I'm seeing an issue on android stock browser with my game where if I tap once on a sprite or button, the callback function gets triggered twice. Here's my code:

var it = this.game.add.sprite(0, 0, 'backing');it.alpha = 0;it.inputEnabled = true;it.input.useHandCursor = true;it.events.onInputDown.add(this.hitzoneClick.bind(this, 0));

The same thing happens with phaser buttons. Has anyone else experienced this?

Phaser v1.1.3

Link to comment
Share on other sites

It might be once from the mouse event and once from the touch event? (although that shouldn't happen as I ignore mouse events on Android, but you never know). What pointer is set to the Signal? (console.log it out and you'll see) as if it's 1 from mouse and 1 from touch you should see two different pointer IDs come in.

Link to comment
Share on other sites

Hey rich, I tried your suggestion. Only 1 pointer id is printed. I also tried disabling the mouse entirely but I get the same results.

 

I tried the "Click on an image" example in the stock browser to make sure that I wasn't doing something weird in my code and I confirmed that the alert also fired twice. Strangely enough, if I scroll a little bit downwards so that the image is halfway out of the screen and I tap on it, the alert is only fired once.  :wacko:

Link to comment
Share on other sites

You may be right. The timestamps reveal that the events occur within milliseconds of each other. Some further testing also showed that if I scroll to the bottom of the page and play, only one touch event is triggered. Anywhere else and 2 events are triggered. Is there a scaling mode that ensures that no scroll bar will be required on the page?

Link to comment
Share on other sites

  • 4 months later...

I just bought my Samsung Galaxy Tab 3 8-inch and the stock browsers has that:

 

* Firing 2 mouse down events on tap, however the second can have arbitrary delay (0.1-2 seconds) and x and y don't always match exactly (close but not exact)!

* Holding down then releasing fires only 1 event, but during the holding the game freezes :)

 

LOL

Link to comment
Share on other sites

  • 1 year later...
  • 6 months later...
Quote

Hi, it's still an issue on Android Chrome and default browser. To prevent this I had to disable inputEnabled property of the sprite after input but it's a very big issue. Isn't it a bug for Phaser?

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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