Scroll Through Tabs in Flex with Mouse Wheel

I blogged the other day about an Office 2007 feature for the tabs that are apart of the ribbon in that you can use your scroll wheel to change the selected tab. I thought this was actually pretty cool.

I decided to implement it in Flex because I figure it would be extremely easy... and it was! Took about 15 minutes total. However, it seems it is having issue when playing without a breakpoint in the code. Just playing through normally, when I scroll up or down, it actually seems to skip a tab when going through them. Yet, if I put a breakpoint at the beginning of the event handler and play through it that way, it goes to the next tab as it should.

Here is a demo of what I have done. Source is included...

http://www.kylehayes.info/tabby/TabThumbWheel.html

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Nice, works perfectly for me :) Perhaps your mouse (or driver) is doing something dodgey?...
# Posted By Justin Carter | 5/8/08 2:42 PM
great job mang! i made an edit to the wheel handler function. it's more of a personal preference. prevents the looping.

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--;
}
}


random facts: i grew up in Covina, went to San Dimas HS. g/f is a CalPoly Pomona Grad also.
# Posted By davididas | 5/8/08 2:52 PM
Only works in FireFox
# Posted By Tony Fendall | 5/8/08 4:53 PM
@davidas, Yeah the looping was intentional as I was duplicating the feature in Office 2007. However, if this were extended to be a custom component or something of the sorts, I would definitely have the looping be an option.

@Tony, I have actually found this to be widely inconsistent in browsers. Both my PC IE and FF do the skipping thing, whereas it doesn't even work for me on my Mac.
# Posted By Kyle Hayes | 5/8/08 7:24 PM