Monday, September 5, 2011

Adding a Scroller in Spark Component

Flex 3 components had scrollers in-built in the components that we used. However, that is not the case in Flex 4 (Spark). Scrollers are not usually required in applications, mainly because people do not like scrolling through the page. A saying goes like, "If there's a scroller to a component, probably the things behind the scroller are not that important".Which is why most applications today do not contain a lot of scrollable areas. The removal of in-built scrollers from the components thus added an edge to Flash applications by removing the overhead of the extra code that is mostly not used and thus reducing the overall size of the application.
However, there will be some cases in an application where we need to use the scroll feature. So how do we implement this in Flex 4. The code below explains the same,

<s:Application .........

      <s:Group id="scrollGroup" .... >
            <!-- component UI here -->

As simple as that. Add the required properties into the scroller (left, right, top etc...) and you can customize it. You can even skin the scroller separately to what you require.

No comments :