Flex 3 Scroller Component
by Paul Taylor, Apr. 18, 2010, under [ actionscript, community ]

Here’s a Scroller component similar to Flex 4′s Scroller. It takes a single DisplayObject child and creates scrollbars at the edges.

Scroller has an inset property, which controls whether the scrollbars overlap the content area or not. You can set the inset property to false, which will move the scrollbars outside the content area.

Scroller supports scroll “ramping”. When you hold one of the arrow buttons, instead of scrolling by 1 each time, it supports the ability to “ramp up” the scroll delta, which increments the position up to a certain threshold and scrolls that amount until the button is released.

Scroller also supports manual or virtualized scrolling. If you want to use Scroller, but don’t want Scroller to manually reposition the content area, you can specify which properties on the target to measure width and height, and which to set when the scrollPosition changes.

Here’s a demo, and you can find it in a common component library I’m releasing on github called PTLib. I’ve tried to test it in creative ways, but I’m sure there are still bugs. So if you find some, just fork it, fix it, pull request it!

Leave a Reply: