4 Replies Latest reply on Apr 29, 2010 9:49 PM by toft

    VDividedBox - maximize one or the other child

    toft Level 1

      I want to use a VDividedBox in a project and would like to be able to alternate maximizing the child components by code. I have tried setting the children`s percentHeight to 0 / 100 but it doesnt work properly.

       

      Is there an easy way to do this ?

       

      PS: Its not an alternativ to use another component in this case.

        • 1. Re: VDividedBox - maximize one or the other child
          David_F57 Level 5

          hi,

           

          You can move the divider by its co-ordinates

           

          protected function button1_clickHandler(event:MouseEvent):void

          {

          var dv:BoxDivider = vdb.getDividerAt(0);

          dv.y = 100;

          }

          vdb is the dividebox.
          So to make container 1 taller you simply increase the y value of the first divider
          You may need a little 'fancy' arithmatic code if you are playing with percentages but this should get you started 
          David.

          1 person found this helpful
          • 2. Re: VDividedBox - maximize one or the other child
            toft Level 1

            excellent !! Just what I needed...

             

            Thanks David

            • 3. Re: VDividedBox - maximize one or the other child
              David_F57 Level 5

              hi

              had time to do a quick example

               

              <?xml version="1.0" encoding="utf-8"?>

              <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                 xmlns:s="library://ns.adobe.com/flex/spark"

                 xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

              <fx:Script>

              <![CDATA[

              import mx.containers.DividedBox;

              import mx.containers.dividedBoxClasses.BoxDivider;

               

              protected function button1_clickHandler(event:MouseEvent):void

              {

              var dv:BoxDivider = vdb.getDividerAt(0);

              dv.y = 0;

              }

               

               

              protected function button2_clickHandler(event:MouseEvent):void

              {

              var dv:BoxDivider = vdb.getDividerAt(0);

              dv.y = vdb.height - dv.height;

              }

               

              ]]>

              </fx:Script>

              <mx:VDividedBox id="vdb" width="306" height="500" horizontalCenter="0" verticalCenter="0">

              <mx:Panel id="pnl1" width="250" height="200" layout="absolute" title="Panel 1"/>

              <mx:Panel id="pnl2" width="250" height="200" layout="absolute" title="Panel 2"/>

              </mx:VDividedBox>

              <s:Button x="549" y="44" label="Button" click="button1_clickHandler(event)"/>

              <s:Button x="636" y="44" label="Button" click="button2_clickHandler(event)"/>

              </s:Application>

              1 person found this helpful
              • 4. Re: VDividedBox - maximize one or the other child
                toft Level 1

                Even better...

                 

                Thanks David, I really appreciate your input !!