Category Archives: Cheat Codes

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>