Skip to main content
Participating Frequently
February 26, 2013
Question

MOUSE_DOWN & MOUSE_UP events behaving strangely in firefox and internet explorer w/low framerate

  • February 26, 2013
  • 1 reply
  • 938 views

Basically what I'm seeing is that in Firefox and Internet Explorer only, using the latest flash plugins for each, when the framerate in my game drops due to a large number of display objects on screen (not unexpected behavior), MOUSE_DOWN and MOUSE_UP events seem to get queued up (this probably happens whether the framerate is low or not, but it doesn't have any adverse effects when the framerate is high). Flash will try to process every click that occurs, even though it can take up to several seconds. So, for example, if the user clicks the mouse 20 times in a second, but the framerate is running at around 5 fps, the game will be reacting to those clicks for around 3-5 seconds. It doesn't ignore any of them. This causes some strage behavior in our game and is not desirable. In the standalone flash player, and in Chrome browser, a large number of clicks in a short time frame does not have the same behavior. It seems to treat the most recent click with some priority, so it will cancel out a previous click. A single click in our game will cause an object to generate a path and move to the point on screen which was clicked (think point-and-click to move a walking 2D character).

Since this behavior is so different in 2 browsers, could have something to do with how it's embedded, like the wmode parameter? That seems to be the only idea that comes up searching on Google. Is there some way in my code that I can forcibly make a new mouse_down get processed right away instead of waiting for previous events to complete?

This topic has been closed for replies.

1 reply

Nabren
Inspiring
February 26, 2013

To simplify the order, Flash does:

All events except ENTER_FRAME event according to priority

The ENTER_FRAME event

Renders the frame

So even if you get multiple MOUSE_DOWN or MOUSE_UP events they should all be processed before the ENTER_FRAME event for the current frame. Maybe your issue is the browser isn't rendering the Flash at the FPS that Flash is running at?

As far as I know events should be handled in the order that they were received.

wbfreek21Author
Participating Frequently
February 26, 2013

Ya, the problem isn't that events are coming in out of order, but rather they are somehow getting triggered at an unacceptably slow rate. It's not that the events are complicated. They merely set a boolean _isMouseDown to true and false (for MOUSE_DOWN, MOUSE_UP, respectively). But if I rapidly click, and then let go of the mouse, I'll see that boolean get set true,false,true,false,etc for a few seconds after I let go of the mouse. Why does this delay exist in Firefox and IE but not Chrome or the standalone player? It's almost as if Chrome and the standalone player let events be in their own thread while IE and Firefox, the events get held up, maybe because there is only one thread to use?

Nabren
Inspiring
February 26, 2013

Ya - Chrome handles input with Flash much differently and more elegantly. One thing you will also notice with Chrome is you can mouse down inside of Flash and continue to move the mouse outside of the Flash canvas with the mouse down and still have Flash receive mouse input updates.

Unfortunately, this doesn't seem like a solveable issue because it is within the browser/plugin itself and not anything to do with your code.