Archive for February, 2008

AS3.0 MouseWheel on Mac OS X

I've finally found the time to port my SWFObject add-on SWFMacMouseWheel (catchy I know) to ActionScript 3.0 and SWFObject 2.0

There's now two examples in the zip, one for use with SWFObject 1.5, and a totally re-written version for use with SWFObject 2.0 (formerly SWFFix)

All you have to do in your main application class (or document class) is

Actionscript:
  1. import com.pixelbreaker.ui.osx.MacMouseWheel;
  2.  
  3. MacMouseWheel.setup( stage );

You can then add listeners to TextFields, Sprites etc etc as you normally would any other MouseEvent.

Example JavaScript to be used with the dynamic embed method

JavaScript:
  1. var vars = {};
  2. var params = { scale:'noScale', salign:'lt', menu:'false' };
  3. var attributes = { id:'testObject', name:'testObject' }; // give an id to the flash object
  4.  
  5. swfobject.embedSWF("test_as3.swf", "flashContent", "100%", "100%", "9.0.0", "js/expressInstall.swf", vars, params, attributes );
  6. swfmacmousewheel.registerObject(attributes.id);

I have updated the SWFObject 2.0 version to be more compact, and it also falls inline with the code style of SWFObject2.0. see swfmacmousewheel_src.js for the uncompressed version, deploy swfmacmousewheel2.js on your site.

Download source and demo here or view the demo online