
Until today Flex or Flash Player mouse events do not contain a deltaX property or any other method of identifying a horizontal mouse scroll. Simply put there is no current way of identifying horizontal mouse scroll within Flash Player. Getting out of flash, even Javascript doesn’t have a standard way to capture mouse based scrolling. This solution from FlexAmphetamine is by far the best one I have come across. Works pretty well but in limited environments.
So I took this solution and put it together with flex to enable scrolling for your flash based applications. All I have done is captured the js events and forced a scroll on any scrollable control within the application. Attached is the actionscript class that does this. By simply attaching this class to your project you can get Mac mouse/touchpad based scrolling working on you flash application. The test application is also within the source zip. Tested on Mac Firefox 3.6/Safari 5/Chrome 5.
See it work on Creately now.
Download the source
Image from: gadgetsreport.com
Comments on: "Finally! Touchpad and Mouse wheel scrolling for your Flash application" (9)
[...] Creately ← Finally! Touchpad and Mouse wheel scrolling for your Flash application [...]
Hey Hiraash, great post! A big headache issue and u’ve come with the solution! Kudos!
BTW, the “download source code” link seems to be missing!
Thanks Alan! sorry about the broken link, had used a free file sharing service before. I have fixed it now. Have fun!
Download source still not working.
Today it’s working…cheers! New question. In my datagrid, scrolling down by mouse wheel now works, but when I scroll up, it immediately jumps to the top of the data grid. How do we get even scrolling both down and up? Thanks.
Hey Marc, Really sorry about the delayed response. Everything has been very hectic after my holiday.
About your question. I didn’t particularly see this behavior anywhere. However one problem that occurs with this solution is that this assumes that all controls have the same scroll step as 1 pixel. A data grid would scroll by rows. So when the ScrollHelper request the data grid to scroll 10 pixels, the datagrid actually scrolls 10 rows. The problem can be solved in multiple ways. If you are just using the scroll helper only for the datagrid, you can customize it to get the scroll size and then scroll accordingly. If it is used application-wide, you will need to implement a interface which will provide the step size to the ScrollHelper. This means extending controls that have the scrolling problem. You can avoid this for controls that extend the mx.core.Container object since they already provide the horizontalLineScrollSize and verticalLineScrollSize properties. I will be improving the ScrollHelper when I get a chance. Do let me know if it may be useful for you anytime sooner.
Whot about Adobe AIR?
(FP-1262)
This solution of course won’t work on a AIR app. If I do come across one, will let you know.
Thx.