Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make flex only consume mouse scroll and keyboard events when it's useful, and otherwise pass it on to the browser?

This one's been irking me for a while. When I'm using the mouse scroll wheel to scroll up and down in a webpage, and a flash movie comes into the path of the cursor, the scroll wheel stops working. Also, when a flash movie has focus, you can't use browser shortcuts like Ctrl + L or Ctrl + R.

I'm writing a flex application now and I'd like to find a solution, so that at least my users aren't plagued by this inconsistency of the user interface behavior.

I should think there would be a way to tell flash to propagate such events as the mouse scroll wheel and keyboard input back up to the browser unless they occur in an element for which they are useful, like in a flex textarea. I can't find any solutions out there though, nor even anyone talking about it.

Specifically, how can I make it so that:

  • When the user is scrolling with the mouse, the browser scrolls unless the mouse is over a flex container with scrollbar, or another component that wants to scroll.
  • When the user presses a button or combination of buttons on the keyboard, it will be propagated to the browser unless there is an active keyboard listener, or the cursor is in a text field, etc.
like image 301
Jack Senechal Avatar asked Dec 11 '25 03:12

Jack Senechal


1 Answers

Communication between the browser and flash is done via ExternalInterface. ExternalInterface allow you to call ActionScript methods from JavaScript and vice-versa.

Good luck with that because experience shows it's often painfull to deal with keyboard shortcuts and browser inconstancy

like image 64
Florian F Avatar answered Dec 13 '25 00:12

Florian F