2 Replies Latest reply on Oct 31, 2007 10:44 AM by Gregory Lafrance

    layout management question

    alfanez
      let's say that in an application all components have percentage based sizing.
      Somewhere there's a VBox with any number of children.
      The problem is when you add children to the VBox its containers are growing infinitly even causing the application to display scrollbars

      for example, in this case :

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Panel width="100%" height="100%">
      <mx:Vbox width="100%" height="100%">

      </mx:Vbox>
      </mx:Panel>

      </mx:Application>

      ..I would like the Panel to display scrollbars when the VBox is to large but instead its the application size that is growing.

      Anyone can help ?
        • 1. Re: layout management question
          ntsiii Level 3
          Try assigning a calculated height to the panel:
          <mx:Panel ... height="{this.height}" ...

          Tracy
          • 2. Re: layout management question
            Gregory Lafrance Level 6
            ntsiii suggestion worked, as in the code below:

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="0xFFCCCC">
            <mx:Label text="Application has a light red background."/>
            <mx:Panel width="{this.width}" height="{this.height}" backgroundColor="0xCCCCFF">
            <mx:Label text="Panel has a light blue background."/>
            <mx:VBox width="100%" height="100%" backgroundColor="0xCCFFCC"
            verticalAlign="middle" horizontalAlign="center">
            <mx:Label text="VBox has a light green background."/>
            <mx:TextArea text="TextArea has a white background. Increase the TextArea width and height to see scrollbars."
            width="1500" height="1500" />
            </mx:VBox>
            </mx:Panel>
            </mx:Application>