开发者

mouse wheel operates on scrollbar

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 th开发者_高级运维e 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜