3 Replies Latest reply on Oct 29, 2007 12:59 AM by virgo_ct2

    Strange DividedBox behavior with states and height

    virgo_ct2
      In the simple code below, why does the Resize state functionality break after I set the height of a container manually? This seems to a problem in horizontal or vertical DividedBox. It is easy to reproduce - any suggestions would be welcome!

      -----------------------------------------
      StatesHeightProblems.mxml

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="postCreation()">

      <mx:Script>
      <![CDATA[
      private function postCreation():void {
      myDivBox.addChild(new MyPanel());
      myDivBox.addChild(new MyPanel());
      }
      ]]>
      </mx:Script>

      <mx:Label text="1) After application loads, play with clicking the resize buttons to see each panel shrink, then use the divider to drag them larger again" />
      <mx:Label text="2) Now, click the button below to set the height of the first panel to 200, then click Resize me! on either panel - why does it not resize any more?" />
      <mx:Button label="Set first panel's height to 200" click="myDivBox.getChildAt(0).height = 200" />
      <mx:VDividedBox id="myDivBox" width="100%" height="100%" />

      </mx:Application>

      -----------------------------------------
      MyPanel.mxml

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

      <mx:states>
      <mx:State name="panelMin">
      <mx:SetProperty name="height" value="30" />
      </mx:State>
      </mx:states>

      <mx:transitions>
      <mx:Transition id="panelTrans" fromState="*" toState="*">
      <mx:Resize duration="500" target="{this}" />
      </mx:Transition>
      </mx:transitions>

      <mx:Button label="Resize me!" click="currentState = 'panelMin'" />

      </mx:Panel>