View Full Version : mouseWheel direction
flash_boy
11-17-2008, 04:30 PM
How do I capture the direction of the mouse wheel. I am working a tool that allows users to zoom in and out on images using the mouse wheel. Not a big deal for one direction and probably not a big deal for both but I'm pretty new to Flex and could use any help you all might be able to offer.
Sincerely,
flash_boy
Hockey13
11-18-2008, 04:39 PM
Hi flash_boy,
I'm relatively new to flex as well, but perhaps I can help you. After searching around, I was able to find this:
http://www.kylehayes.info/blog/index.cfm/2008/5/8/Scroll-Through-Tabs-in-Flex-with-Mouse-Wheel
On that page, there is this code:
private function mouseWheel_handler(event:MouseEvent):void
{
if(event.delta > 0)
{
if(this.selectedIndex != this.numChildren-1)
this.selectedIndex++;
}
else
{
if(this.selectedIndex != 0)
this.selectedIndex--;
}
}
It looks like the delta property of a MouseEvent is set to a positive number when the wheel scrolls forward and to a negative number when it scrolls back. I could be wrong about the direction, but give it a try and let me know how it works for you (I'm at work (finance, not programming ;-), so I can't get into Flex right now).
Hockey13
11-18-2008, 05:05 PM
Quick follow-up...I found another site that covers this topic a bit:
http://www.kirupa.com/forum/archive/index.php/t-275845.html
-Hockey
flash_boy
11-19-2008, 02:04 PM
I didn't try the second one but the first worked perfectly. Thank you very much.
Sincerely,
flash_boy
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.