HTML5 MouseEvent.MOUSE_DOWN in mobile browsers

Hi all!

Now this is a little vague. It doesn’t happen all the time and not in any browser
but it does happen! If I view a generated HTML5 application in Chrome on Android
for example, the MOUSE_DOWN events do not fire. What makes it even more
strange is that not all buttons inside this application are affected - so some buttons
work, while others do not. If I replace any MOUSE_DOWN event by MouseEvent.CLICK
the problem is gone. I don’t know if it’s important but I’m using Canvas instead of WebGL.
Did anyone ran into this too and what could fix it?

I think that the browser is sending TouchEvent rather than MouseEvent

Does this occur with a sample such as PiratePig?

No, PiratePig seems to work fine. Also FireFox on Android works flawlessly.
I stumbled over this rather old thread: HTML5 Mobile browser MouseEvents not triggering
Is there a connection?

Hmm, it seems like this was resolved. You said you were using canvas – it should not matter, but you could try -Dcanvas when trying PiratePig to see if it behaves any differently.

Hi singmajesty.

Yeah this is really weird. Let me tell you a boring story.
Initially we were using Webgl. On one of my devices running Android 5

  • latest Chrome everything was fine. On my mates device, a Samsung
    S7 running Android 6 I think, the buttons didn’t respond. Additionally
    we had a little trouble with a background vector image. It’s a gradient
    which should fill the entire available screenspace. I suppose we might
    have exceeded the maximum texture size because on his device the
    background would have to be 2560x1440. So we just saw pure
    black instead of the gradient. By the way - does this have to do with
    the texture size?
    Let’s move on! After some testing we come to the conclusion that using
    Canvas instead of Webgl seems to work on both of our devices. So from
    this time on we’ve used Canvas for all our projects. Obviously it might not
    be related though. Recently it was my device which has problems with the
    MOUSE_DOWN event.
    I just put some trace messages to HTML5Window.hx and it’s dispatching
    just fine! So the problem seems to be somewhere else.
    There’s one thing worth mentioning: If I hold the device in landscape
    orientation, it doesn’t respond to MOUSE_DOWN. If I rotate the device to
    portrait all of a sudden those buttons work!

Could you try adding a listener to the stage, and see if you still receive events? Perhaps it comes through, but maybe the coordinates are off, so you don’t receive events on your target object?