Using scroll bars

Flex containers support scroll bars, which let you display an object that is larger than the available screen space, as the following figure shows:


Container with scroll bars

In this figure, you use an HBox container to let users scroll an image, rather than rendering it at its full size. The following code defines the HBox container shown in this figure:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" borderStyle="solid" height="600" width="600">

   <mx:HBox width="75" height="75" >
      <mx:Image source="mm.jpg" />
   </mx:HBox>
</mx:Application>

In this example, you explicitly size the HBox container to 75 x 75 pixels, a size much smaller than the imported image. If you omit the sizing restrictions on the HBox container, it will attempt to use its preferred size, which is a size large enough to hold the image.

By default, Flex draws scroll bars only when the contents of a container are larger than that container. To force the container to draw scroll bars, you can set the hScrollPolicy and vScrollPolicy properties to on.


Version 1.5

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/15/flex_docs_en/00000301.htm