views:

155

answers:

1

If a SWF file or even a component within it has scrollbars, wouldn't it make sense that if the user is hovered over that area (it's in focus) and uses the mouse wheel, that this movement would automatically translate to the scrollbar moving.

Any ideas how this is done, the events or classes used for this? I'm open to outside components or classes too. I haven't started yet, but I'll do an item renderer because it's easy to give it scrollbar.

+1  A: 

Here's some code which will let you deal with mouse wheel scrolling, it's pretty easy to deal with:

objectToBeHoveringOver.addEventListener(MouseEvent.MOUSE_WHEEL, scrollObject);

function scrollObject(event:MouseEvent):void
{
    trace(event.delta);
}

The event.delta part will be a number that's either positive or negative, depending on which way you scrolled the wheel. You can use this to move your object up and down. Hope this helps.

debu

debu