Jump to content

Sprite.Events.OnDown fired twice in Android Stock Browser


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 :)



Link to comment
Share on other sites

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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