How to get Scrollbar for Constraint based Containers

A quickie out here…In a recent project I am working on (Tryptich ebook reader in flex)..For the Demo part we had a requirement where in I had to insert this long image in a Vbox with width 100% and height 100%..The image got loaded but no scroll was there…Since it was all 100% …as expected the image squashed itself to fit in that 100%…I googled and found a cool solution (thanks to the guy who figured it out) Well, you just mention minHeight in the container which hosts the image and there you get the scrollbar by magic…

No time for details but do check the code below for reference…

<mx:VBox width=”100%” height=”100%” paddingLeft=”7″ paddingRight=”7″
    paddingBottom=”7″ paddingTop=”3″ horizontalScrollPolicy=”off”>
  
  <mx:VBox horizontalScrollPolicy=”off” verticalScrollPolicy=”on”
    styleName=”mainVBoxWhite” width=”100%” height=”100%” minHeight=”0″ minWidth=”0″>
          <mx:Image id=”ttContent” source=”assets/pages/ch1_1.gif” complete=”loadComplete(event);” />
      </mx:VBox>   
  </mx:VBox>

Advertisements

2 responses to “How to get Scrollbar for Constraint based Containers

  1. Thanks for this Tip!! I tried for hours with nested repeaters inside a VBox and i never get scrollbars until i find your trick! great.

    greets wazzzup

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s