I ran across a recent entry about MouseWheel events on Mac OS X and Flash by Christian Cantrell and realized there were at least 4 cool implementations that I was aware of. Thought I would list them out here, including a modification I made to one that I have been using and has been around for at least a year or longer now. I really like the anonymous JS function injection approaches that several of them leverage. So here they are:

Takanobu Izukawa of the Spark project:
http://www.libspark.org/wiki/SWFWheel/en
http://www.libspark.org/wiki/SWFSize/en

Gabriel Bucknall – PixelBreaker – AS3.0 MouseWheel on Mac OS X
http://blog.pixelbreaker.com/flash/as30-mousewheel-on-mac-os-x/

Ali Rantakari – Mac OS X Mouse Wheel Support for ActionScript 3 Flash Applications (v.2+)
http://hasseg.org/blog/?p=138

Matt Giger – Simple solution for MOUSE_WHEEL events on Mac
http://blog.earthbrowser.com/2009/01/simple-solution-for-mousewheel-events.html

And here is a link to download a modified version of the JavaScript portion of Gabriel “PixelBreaker” Bucknall’s solution that I worked on to fix a few issues and add some functionality grab it here. I like Gabriels version as he put together an AS2 and AS3 version, it works perfectly with SWFobject 2.1, and with my fixes, multiple items on a page. I had started working on another version that also used externalInterface to leverage the anonymous function injection approach, but given that all three other variations on this issue already provide that functionality, I didn’t want to re-invent the wheel.

Also, note that all these approaches rely on leveraging externalInterface to pass info back forth between the browser/JavaScript and Flash. If AllowScriptAccess is set to NEVER in your embed, none of these projects will work. For what its worth there is a bug thats been logged on Adobes JIRA Bug system here: http://bugs.adobe.com/jira/browse/FP-216 – that is looking for extra votes – it is related to the current inability to reliably detect what AllowScriptAccess and other HTML properties of Flash have been set to. The best solution and request is to make these items available as System.capabilities.xxxx properties available at runtime. That would be great – so make sure you check out the link and vote it up for the next release of the Flash player!

UPDATE 03.10.09 – 12:51AM: I initially uploaded an old version accidentally – doh! I’ve updated the file, which fixes some issues with multiple instances of Flash on a page. Specifically where Flash instances not registered with SWFMacMouseWheel were still preventing the default page/document scroll if you happened to be mousedover them and they were receiving input. I also included a reference to Richard “Rillkill” Rodney for his tweaks for Safari for PC in the JS and AS3 code – which I failed to note requires changes in the AS to support Safari for PC. I also made a quick change to the AS2 version and zipped them both up and added them to the downloads page. If you don’t need Safari for PC support then you can stick with the original AS files from Gabriel/Pixelbreaker. Enjoy!

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Share/Bookmark
PRINT THIS ENTRY

3 Responses »

  1. [...] Flash MouseWheel Implementations for Mac OS X [...]

  2. Be sure to vote for the bug itself in the Adobe bug tracker:

    http://bugs.adobe.com/jira/browse/FP-503

  3. We recently created a drag-drop component for flash and flex which not only enables the mousewheel on osx (and Safari for PC), but also improves the mouse behavior on all browsers (including IE and other PC browsers). It’s based on our javascript injection tool, so no need for external javascripts or special Embed code.

Leave a Reply