Using the MouseWheel to Scroll in AS3
Posted by Matthew Hancock
Tutorials December 7th, 2007 at 1:09 pmHere is a nice little chunk of code that I wrote to help you enable the MouseWheel in your Flash AS3 files.
// Import MouseEvent
import flash.events.MouseEvent;
// Create MouseWheel Event
public function handleMouseWheel(event:MouseEvent){
trace(event.delta);
}
// Add MouseWheel Listener
addEventListener(MouseEvent.MOUSE_WHEEL,handleMouseWheel);
This will trace the movement from the MouseWheel and that value can be used in your Flash movie however you would like. Enjoy!

January 12th, 2008 at 7:53 pm
Did you know in Firefox that little gem doesn’t do anything if the wmode is set…
The workaround?
In JS…
function mozScroll(e)
{
if(cork.PercentLoaded() == 100)
if(cork.FirefoxMouseWheel)
cork.FirefoxMouseWheel(0, e.detail);
}
if(window.addEventListener)
{
window.addEventListener('DOMMouseScroll', mozScroll, false);
}
…and in AS3…
ExternalInterface.addCallback("FirefoxMouseWheel", ZoomInOut);
...
public function ZoomInOut(event:* = null, mozDeltaOverride:* = null):void {...}
July 15th, 2008 at 9:21 am
I’ve noticed that Firefox and wmode do not play well with one another quite frequently. Thanks for the info!