Thursday, June 18, 2009

MouseWheel Scroll on Mac for Flash AS3 (SWFWheel)

Do Mac mice even have a wheel? They only have 1 button so what do they need a wheel for??? ;)

Apparently Mac mice have wheels and Mac users would like to be able to use them just as their PC counterparts do. Unfortunately for them, the Mac OS gives the browser the focus for onScroll events and somehow Flash is left clueless that anything happened.

There are quite a few third party solutions out there. While researching I came across a great article from Robert Hall on four of those solutions.

From our research it seemed that all four solutions were viable options. However, we ended up going with SWFWheel, which was developed by Takanobu Izukawa.

We chose SWFWheel for three main reasons:

First off, it is part of the SPARK project, which I highly respect due to the quality of the other projects contained in their library.

Secondly, it was announced recently on JActionScripters that SWFWheel was being adopted by the latest Gaia Framework. An endorsement from Gaia goes a long way in my book.

Lastly, the project seemed recent and supported the latest browsers. Most of the other solutions seemed to have been created over a year ago. They could be compatible with the latest browsers, but it was not certain. SWFWheel is the only option that we found that specifically mentions supporting the latest browsers such as IE 8 and Chrome 1.

With that being said, if you choose to add SWFWheel to your project you should start by downloading the source from the project page.

Import org.libspark.ui.SWFWheel into your class and place SWFWheel.initialize(stage); in your constructor.

In you HTML page, ensure that you assign an ID to your embedded Flash file. This ID is used by the javascript to reference the embedded object. Add the the external javascript file: swfwheel.js to your HTML the same way you would add swfaddress.js. Just place the script right below swfobject and you should be good to go.

That is it. Simple importing of the .as file. Simple importing of the .js file. Initialize SWFWheel with your stage and away you go. No black magic. No fairy dust.

So far we have had good luck with it. I commend the developer and the SPARK project for putting together a very clean and easy solution.

3 comments:

eduard said...

Please, can you explain how I can...
In you HTML page, ensure that you assign an ID to your embedded Flash file.
Thanks

soundkitchen said...

Thanks to introduce SWFWheel!!

Takanobu Izukawa

Unknown said...

Website pop over to this website article source go to this web-site read here high quality designer replica