Tutorio.com

Pages: 1.2.
Using Mouse Scrollwheel in Flash
One of Flash's usability problems has been the inability to use a scrollwheel.This tutorial details two methods of by which a mousewheel can be used with flash and the pros and cons of each method.

Method 1: FlashPlayer 7 built in

Flash player 7 for the first time ships with a built in method of using the mousewheel. TextField.mouseWheelEnabled is a Boolean value that indicates whether sets wether the textfield can be scrolled via a mousewheel. By default this value is set totrue so all text fields will scroll unless otherwise instructed. This is a player specific function so even if the movie is published in flash player 6 a preson viewing it with flash player 7 will be able to use a mouse wheel to scroll.

Example 1

Note: Click you must on the movie to set focus.
Download Source Files

To use mousewheel values for things other than textfields we must use the mousewheel listener object and the onMouseWheel. This is NOT a player specific function and as a result it must be published flash player 7.

The code used in the example
mouseListener = new Object();
mouseListener.onMouseWheel = function(delta) {
   clip_mc._xscale += delta;
    clip_mc._yscale += delta;
}
Mouse.addListener(mouseListener);
A new object mouse listener is created a mouse listener is added to it. The mouse listener is then called whenever the mouse wheel mose to scale the movieclip.
Rating(28) +- Pages: 1.2.
Tutorio.com. Privacy Policy, Contact