SWFMouseWheel

Flash MouseWheel on Mac Os, Windows and Linux.

SWFMouseWheel is an open source cross-platform solution for using the mousewheel in Flash, and an alternative to the mouseWheel Event in ActionScript. It is published under the MIT Lisence.

SWFMouseWheel was developed to fix mousewheel functionality for Flash apps on Mac OS, which doesn't have native mousewheel support. It's done by setting up an ExternalInterface between ActionScript and JavaScript, that listens to mousewheel events in the DOM.

We're still in alpha mode, so use at own risk.

Implementation

In your HTML header:

<html>
<head>
<title> </title>

<!-- Include script and pass the SWF 'id' with the querystring -->
<script type="text/javascript" src="swfmousewheel.js?id=myMovieId"></script>

</head>
<body>

...

In AS3:

package {

	import flash.display.MovieClip;
	
	// 1: import SWFMouseWheel
	import com.oysteinwika.ui.SWFMouseWheel;

	public class SWFMouseWheelExample extends MovieClip {

		public function SWFMouseWheelExample() {
			
			// 2: init SWFMouseWheel
			SWFMouseWheel._init();
			
		}
		
		// 3: SWFMouseWheelHandler function
		SWFMouseWheel.SWFMouseWheelHandler = function(_delta:Number):void {
			// your code goes here...
			// maybe something like this: 
			// scrollButton.y -= _delta*20;
		}
	
	
	}
}

Example

SWFMouseWheelExample.html

Download Source Files

swfmousewheel_1_0_alpha4.zip

SWFMouseWheel On Google Code

http://code.google.com/p/swfmousewheel/

Known Issues

  1. Buggy in Opera. ExternalInterface doesn't play well with Opera. We are researching this eagerly.
  2. Scroller speed is much higher on Safari/MacOS X than other systems. A fix for this will be implemented in a later release.

Milestones

SWFMouseWheel will be released in two versions: One stand alone version, and another plug-in version to SWFObject 2.0 (not released yet).

All for now :)

Øystein Wika
http://oysteinwika.com