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]