Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

2. Containers > 2.7. Enable Scrolling in a Container

2.7. Enable Scrolling in a Container

Problem

You want to add scrolling capabilities to a container whose child elements are positioned outside of the defined viewport bounds.

Solution

Wrap a Group or DataGroup container in an instance of spark.components.Scroller and define the dimensions and clipAndEnableScrolling property of the container, or assign a container as the viewport property of a spark.components.ScrollBar instance.

Discussion

Unlike MX containers, which support scrolling internally, the separation of responsibilities within the Spark architecture provides more lightweight containers and affords more control over delegating tasks. Within the new Spark paradigm, you can assign specific controls that handle navigating within a container. The spark.components.supportClasses.GroupBase class, which both DataGroup and Group extend, is an implementation of the IViewport interface. By default, the clipAndEnableScrolling property of a GroupBase-based container is set to false and the container renders child elements outside of any specified bounds. Setting the clipAndEnableScrolling property to true and wrapping the IViewport instance in a Scroller component renders child elements within a defined area and updates the read-only contentWidth and contentHeight properties of the container to the specified dimensions.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint