SWFObject add-on: MouseWheel on Mac OS

I’ve had the mouse wheel working in flash on OS X for a while, and after seeing the SWFAddress add-on for deconcept’s SWFObject embedding system, I thought I’d add mousewheel functionality to SWFObject, rather than using my own “frankenstein” embedding system.

It’s straight forward to implement. Download SWFMacMouseWheel here.



Within ActionScript, you’ll barely notice any difference. Only that instead of using Mouse.addListener(), you’ll refer to my class instead.

Example code:

[as]
import com.pixelbreaker.ui.MouseWheel;

class Example
{

function Example(){
MouseWheel.addListener( this );
}

public function onMouseWheel( delta:Number ):Void
{
// do something with the delta value
}
}

[/as]

All the javascript is included in the zip, with an example html file.

You simply have to add one line of code to the javascript:

[js]
var so = new SWFObject(‘test.swf’, ‘website’, ‘100%’, ‘100%’, ‘8′, ‘#FFFFFF’);

so.useExpressInstall(‘js/expressinstall.swf’);

so.addParam(‘menu’, ‘false’);
so.addParam(’scale’, ‘noscale’);
so.addParam(’salign’, ‘lt’);

// CHANGE BELOW
if( so.write(‘flashcontent’) )
{
var macmousewheel = new SWFMacMouseWheel( so );
}
[/js]

72 Comments so far

  1. Geoff / November 9th, 2006 01:06

    Awesome, this is actually very useful… we have clients all the time that want mouse wheel support on macs.

  2. pixelbreaker / November 9th, 2006 01:30

    Hi Geoff, glad it’s of use. I’ve also got a little class that allows flash movies to be 100% of the browser, but not go below a certain size, I’ll make that work along side SWFObject in the next week, I’ll let you know when it’s done.

  3. [...] Extending Flash support in browser is the new black these days. Pixelbreaker adds a very welcome addition by extending support for the mouse wheel in Flash to the Macs with is own MouseWheel extension. Finally mouse wheel support is no longer Windows only! [...]

  4. cach / November 9th, 2006 10:15

    [...] ya puedes utilizar la ruedecita del rat

  5. pixelbreaker / November 9th, 2006 12:18

    hi zokdok, I’ll get it done asap, just i’m finishing my current employment tomorrow, so big party tonight, gonna be a bit tricky to get anything done before sunday…

  6. danielyuen.hk Blog : links for 2006-11-09 / November 9th, 2006 15:26

    [...] pixelbreaker

  7. pixelbreaker / November 11th, 2006 23:38

    It should work fine with Flash 7, you just have to be using ActionScript 2.0. The version available above will only work with SWFObject. I’ve not had any issues using SWFObject with different layouts.

  8. jeanphilippe / November 12th, 2006 10:02

    Hi,
    It seems it doesn’t run on Safari 2.0.4, flash Player 9

  9. pixelbreaker / November 12th, 2006 16:22

    I’m running it on Safari 2.0.4 here, and it’s fine.

  10. [...] Mac ScrollWheel Support [...]

  11. Dave Glanz / November 14th, 2006 18:47

    With Safari, I get this message when opening the sample:

    str:
    onMouseWheel: [type Function]
    $version: MAC 9,0,16,0
    mouse_txt: _level0.mouse_txt
    test_txt: _level0.test_txt

    Using Firefox 2.0, I’m getting the “You need to upgrade your Flash Player!” message.

  12. Dave Glanz / November 14th, 2006 18:48

    With Safari, I get this message when opening the sample:

    str:
    onMouseWheel: [type Function]
    $version: MAC 9,0,16,0
    mouse_txt: _level0.mouse_txt
    test_txt: _level0.test_txt

    Also, when using Firefox 2.0, I’m getting the “You need to upgrade your Flash Player!” message.

  13. pixelbreaker / November 14th, 2006 19:17

    Dave, the flash detection is working in firefox 2.0 on Windows and OS X for me, maybe you should direct questions for that to deconcept (who made the detection scripts).

    The message you see in safari is correct, that’s what my test movie shows… once you scroll the mouse wheel, you should see another textfield to the right, echoing some numbers,

  14. [...] A couple of weeks ago pixelbreaker released a kick-ass add-on to SWFObject called SWFMacMouseWheel which enables the mousewheel support in Flash for OSX.  I was a little bummed on their example code though… so I’ve created a little example of some scrolling textFields. It uses a simple hitTest to see if mouse is over the textField and then increments the vPosition accordingly. example [...]

  15. Dai / November 27th, 2006 15:22

    Great work!
    It works on safari 2.0.4 and OSX 10.4.8.

  16. Kev Sutherland / December 4th, 2006 11:06

    Hi, I too am getting the same response as Dave, I see the textfields on the top left but when I use the mouse scroller I don’t see anything changing, this happens when I use firefox or Safari. I’m running FP 9 in both cases.

    Both the example SWF and my own attempts both fail to show output from the scrollwheel.

    Any ideas?

  17. Pedro Jonen / December 5th, 2006 12:27

    Hi… I also had the same Problem lke Dave and Kev, using Saf 2.0.4 or Firefox 2.0…
    LOCAL… it has to be online (on the Server) to work!!!

    Thx, it’s great!

  18. pixelbreaker / December 6th, 2006 14:50

    Pedro, you probably have to change your flash player security settings and allow “c:\” if you’re on PC or “Macintosh HD” if you’re on mac.

  19. Zokdok / December 8th, 2006 15:51

    You might want to change the main() to init() or something when you’re used to work with mtasc (like me).

  20. mecklen / January 24th, 2007 15:56

    While working with Flex 2 on a AS3 project a textfield suddenly scrolled by wheel – and this on the MAC!!! standalone debug player. Also MouseEvent.MOUSE_WHEEL is broadcasted. Although the mac mouse wheel support is still missing in the flash plugin itself (9.28), it seems to be in the pipe now!

  21. [...] Extending Flash support in browser is the new black these days. Pixelbreaker adds a very welcome addition by extending support for the mouse wheel in Flash to the Macs with is own MouseWheel extension. Finally mouse wheel support is no longer Windows only! [...]

  22. [...] » Läs mer på pixelbreaker.com. [...]

  23. [...] Part of eepmon version 3 allows the user to use their mouse wheel to scroll through content. Works great in Windows but no go on a MAC.  So I’ve done a google search and stumbled upon pixelbreaker’s site where he has resolved the mouse wheel conflict. [...]

  24. [...] Mac OSX Support [...]

  25. [...] Get all the info here [...]

  26. DYOBLOG / March 15th, 2007 11:34

    クロスプラットフォーム Flashスクロールクラス&JS Beta…

    ジミーな研究。 ■Flash8のスクロール関係コンポーネントがどうも使いづらい。……

  27. guzelsozler / March 15th, 2007 22:34

    thenk you

  28. Shane McCartney / March 16th, 2007 06:59

    I have desccovered a bug with this code with the undocumented scrollTarget parameter onMouseWheel event. Basically this param tells you what movieclip the mouse is currently over. The following code fixes this if this could be updated in the source it would be a good idea.

    The solution is a bit of a hack but it works

    private public static function externalMouseEvent(delta:Number):Void
    {
    var st:MovieClip = _root.createEmptyMovieClip(“st”, _root.getNextHighestDepth());
    st.startDrag();
    //
    st.func = macBroadcaster.broadcastMessage;
    st.scope = macBroadcaster
    st.args = ["onMouseWheel", delta];
    //
    st.onEnterFrame = function() {
    //
    this._x = _root._xmouse;
    this._y = _root._ymouse;
    //
    if (this._droptarget != “” && this._droptarget!= undefined) {
    //
    this.args.push(eval(this._droptarget));
    this.func.apply(this.scope, this.args);
    //
    delete this.onEnterFrame;
    this.removeMovieClip();
    }
    };
    }

  29. Shane McCartney / March 16th, 2007 07:03

    Sorry typo in the above change that first line from

    private static function externalMouseEvent(delta:Number):Void
    {
    var st:MovieClip = _root.createEmptyMovieClip(“st”, _root.getNextHighestDepth());
    st.startDrag();
    //
    st.func = macBroadcaster.broadcastMessage;
    st.scope = macBroadcaster
    st.args = ["onMouseWheel", delta];
    //
    st.onEnterFrame = function() {
    //
    this._x = _root._xmouse;
    this._y = _root._ymouse;
    //
    if (this._droptarget != “” && this._droptarget!= undefined) {
    //
    this.args.push(eval(this._droptarget));
    this.func.apply(this.scope, this.args);
    //
    delete this.onEnterFrame;
    this.removeMovieClip();
    }
    };
    }

  30. [...] Now getting Scroll Wheel to work on Mac is a little trickier as Flash doesn’t have native support for this but there is a way to get this to work in Flash 8. The Javascript and Actionscript provided code from PixelBreaker as a SWFObject add-on allows you to do this. It’s pretty good but has one shortcoming and that is that it only provides the delta parameter and not scrollTarget, I have an Actionscript fix for this and it’s a bit of a hack but hey it works, I hope u find this useful. [...]

  31. hi_gui / March 21st, 2007 18:18

    Great work man, you saved my ass!
    I’m not such an experet, but i did it to work in a couple of hours.
    Thanx again
    hi_gui

  32. pixelbreaker / April 9th, 2007 16:57

    Shane, good that you got scrolltarget working, I never use it, and creating _root movieclips is too hacked for my liking. By all means, publish your own version of the code.

    cheers

  33. [...] SWFMacMouseWheel [...]

  34. [...] UPDATE As the Flash Player for Macs doesn’t have support for Mousewheel events, I have updated the source code with a mac version which uses a javascript workaround. You’ll also need to download the SWFMacMouseWheel class from pixelbreaker. I have tested it on Mac OS X Safari and Firefox, works fine. To install the class, copy the “com” folder and paste it into your Actionscript 2.0 class folder. Typical paths are Windows: Hard DiskDocuments and SettingsuserLocal SettingsApplication DataAdobeFlash CS3languageConfigurationClasses Macintosh: Hard Disk/Users/user/Library/Application Support/Adobe/Flash CS3/language/Configuration/Classes [...]

  35. [...] This extra also showcases the use of the SWFMacMouseWheel javascript, by PixelBreaker. By using this javascript, MAC users can also scroll through the playlist with their mousewheel. [...]

  36. izlesene / June 9th, 2007 18:02

    I want to use vista.. but my os don’t support them!

    youtube
    mirc
    radyo
    mirc
    sohbet
    sohbet

  37. Oliver Bujdoso / June 10th, 2007 16:35

    Works great in Safari, but on Windows with IE, the scroll wheel doesn’t work until you click on something (activeX). The swfobject.js doesn’t work for the scrollwheel.

  38. bilim / June 16th, 2007 10:59

    Wow, this is a great release. I won’t have that much use for the resizable columns, but the new feed navigation is really great for me!

  39. Arkadas / July 8th, 2007 05:42

    Wow, this is a great release. I won’t have that much use for the resizable columns, but the new feed navigation is really great for me!!!

    Murat Boz

  40. Mirc / July 8th, 2007 10:26

    I’ll be checking your blog a lot from now on, and I hope you have it sooner then next week, as I’m currently in the process of adapting the code… which would same me a some time and trouble.
    (Or maybe you could send me the beta code, in which I can help test and bug hunt.)Sohpet

  41. Arkadas / July 10th, 2007 08:20

    I’ll admit, I’m no actionscript pro so if anyone has used this fancy mousewheel stuff with a custom scrollbar such as this:.

  42. gazeteler / July 10th, 2007 20:48

    Hi, I’m Turkish science communicator.I like very very much Nature Podcast.

    Congratulations!

  43. Hasse G / July 13th, 2007 08:51

    Hi. I found your site a while back when I was looking for existing solutions for OS X mouse wheel support, but found none that would be easily plugged to Flex/AS3 apps, so I implemented one myself. You can find it here:

    http://hasseg.org/blog/?p=3

  44. Paylasim / July 14th, 2007 06:13

    Hi. I also had the same Problem lke Dave and Kev, using Saf 2.0.4 or Firefox 2.0.
    Local. it has to be online (on the Server) to work

  45. adobe / July 15th, 2007 07:57

    thanx

  46. [...] SWFMacMouseWheel [...]

  47. kale kapi / July 27th, 2007 01:04

    Shane, good that you got scrolltarget working, I never use it, and creating _root movieclips is too hacked for my liking. B

  48. [...] pixelbreaker : SWFObject add-on: MouseWheel on Mac OS I’ve had the mouse wheel working in flash on OS X for a while, and after seeing the SWFAddress add-on for deconcept’s SWFObject embedding system, I thought I’d add mousewheel functionality to SWFObject, rather than using my own “frankenstein” embedding sy (tags: actionscript javascript swfobject MouseWheel mac flash) [...]

  49. [...] en ai profité pour utiliser le javascript swfmacmousewheel.js qui permettrait à la mousewhell mac de fonctionner sur flash (impossible de vérifier je suis sur [...]

  50. Mouse Wheel problems | zedia flash blog / September 20th, 2007 00:05

    [...] tried to use the fix to make the mouse wheel work in Flash when you use Mac OS X that can be found here. But that didn’t do it. My last option was to use the new technique from the makers of [...]

  51. Paul Mayne / October 19th, 2007 07:43

    Top 6 Flash Development Tools…

    1) Fuse Kit For movieClip tweening I’ve been using the Zigo Tween engine until I saw Moses Gunesch at the Flash Forward conference in Austin showing off this amazing set of classes. Fuse is built upon the Zigo engine and……

  52. [...] Gabriel Bucknail created almost a year ago a SWFObject add-on to bring MouseWheel support to the Mac OS X Flash Player. Seems to be still up to date: Solution [...]

  53. Humming Via Kitchen / February 2nd, 2008 08:28

    AS3でSWFMacMouseWheelを作ってみたよ。…

    SWFMacMouseWheel がAS2にしか対応してないらしくて、
    勢いでAS3に対応したヤツを作ってみたよ。
    使い方はある程度真似てみたんだけれども、
    AS2を知らないので何とも。
    AS側の使い…

  54. Not-so-Minimal Scrollbar at Bumpslide / April 7th, 2008 22:17

    [...] (via FTween). There is a textpanel there, too. Sorry, no buttons on the scrollbar. You are using swfmacmousewheel, [...]

  55. credit card consolidation uk / April 30th, 2008 14:28

    software gioco poker…

    Still best credit card debt help telecharger poker superstars…

  56. FICC inc. at 1222north / May 7th, 2008 15:54

    [...] UPDATE: I was curious, so I did a quick search and discovered that someone figured out how to get the Mouse Wheel to work in Flash on a Mac through SWFObject. BooYah. [...]

  57. [...] AW: mousewheel mit Mac Hi, der genannte Threat von 1manni1 stammt ja von mir Damit das Mouserad auch auf dem Mac funktioniert brauchst du die zus

  58. flash for mac os 9 / June 26th, 2008 07:53

    [...] Player 9 ….. a SWFObject add-on to bring MouseWheel support to the mac OS X flash Player. …http://blog.pixelbreaker.com/flash/swfmacmousewheel/Mac Classic Software Updates and Mac Classic Downloads – VersionTrackerListing current versions of [...]

  59. [...] damit das am MAC funktioniert braucht mal wohl dieses add-on: http://blog.pixelbreaker.com/2006/11/08/flash/swfmacmousewheel/ das ist der beispiel code: PHP:1234567891011121314151617 [...]

  60. [...] whole class is now relying on MacMouseWheel class from pixelbreaker [...]

  61. プロポーズ大作戦 / August 1st, 2008 04:32

    MacでもFlashでホイール操作が出来るようにする (SWFMacMouseWheel)…

    Flashコンテンツでマウスのホイールイベントを利用する場合、そのままではMa……

  62. [...] hack for SWFObject called SWFMacMouseWheel. Apparently it’s been available in one form or another since 2006! Gotta remember to store that one in my brain parts for [...]

  63. [...] Mac OS X Mousewheel Support in AS2 « Moderator: Taking Control Over Your WordPress Comments [...]

  64. [...] the Flash Player. If you are interested in a work around for the mouse wheel issue, check out this post. Also, the longer the list of data, the better the animation effect because there is more data to [...]

  65. X-1 » pX: Thumbnail navigation / February 7th, 2009 23:49

    [...] preloader/caching is handling the load. This version doesnt support mac wheels as it is not loading pixelbreakers excellent [...]

  66. MacのMouseWheel « 2BLOG / February 26th, 2009 13:08

    [...] PIXEL BREAKER.さんがAS3用、AS2用を作られています。 ・AS3 ・AS2 [...]

  67. [...] Site de PixelBreaker : http://blog.pixelbreaker.com/flash/swfmacmousewheel/ [...]

  68. Twitted by richardolsson / July 14th, 2009 08:52

    [...] This post was Twitted by richardolsson [...]

  69. [...] For those who want to know how you can use the MouseWheel for ActionScript 2.0 have a look at this post. [...]

  70. [...] vielleicht bringt das ja was?! > http://blog.pixelbreaker.com/flash/swfmacmousewheel/ [...]

  71. [...] This cross OS mouse wheel functionality is made possible with the use of the ‘MouseControl class’ from MrSteel and the SWFObject add-on: MouseWheel on Mac OS from pixelBreaker. [...]