I have a full screen flex ap开发者_如何学Goplication and I want the user to be able to scroll using browser scrollbars. I don't need mousewheel in the flex application and flex appears to block mousewheel events within itself. So mousewheel events do nothing.
You can do this pretty easily through external interface. Whenever your swf receives a MouseEvent.MOUSE_WHEEL event, call a javascript function that scrolls the page. jQuery can to that for you.
Scroll events are handled differently in different browsers/operating systems so you're going to have to do a bunch of testing. For example, last time I checked you actually had to send scroll events from javascript into flash on OSX if you wanted them to work. Which is good news for you, as the scroll wheel should work on the page(not the swf) by default.
So lets rundown:
- Get the MouseEvent.MOUSE_WHEEL event.
- Call out to javascript with the direction of the scroll
- Move the page accordingly with jquery
- disable all of this if the user is running OSX
- test the shit out of it
If you are targeting Flash Player 10 or above, you can use wmode="direct". Mouse wheel events will work on both Flash and the browser. Since you're not using them in your Flex app, mouse wheel will pretty much just scroll the page.
Works for me on PC Chrome 17, Firefox 3.6 and IE 8.
精彩评论