2 Replies Latest reply on Sep 23, 2007 12:36 PM by leh12345678

    Need to animate HBox width

    leh12345678
      Hello,

      In MXML, I need to know how to animate an HBox component's width from about 220 px to 898 px wide. This would have to happen when I click on something. How would I do this? Please help. Thanks in advance.
        • 1. Re: Need to animate HBox width
          ashar2005
          Here's a simple example in MXML:

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
          <mx:Script>
          <![CDATA[
          public var hbStatus:Boolean = false;

          private function resizeHB(status:Boolean):void
          {
          hbStatus = !status;
          hbResize.end();
          if(hbStatus == true)
          {
          hbResize.widthTo = 898;
          hbButton.label = "Shrink HBox";
          } else {
          hbResize.widthTo = 200;
          hbButton.label = "Widen HBox";
          }
          hbResize.play();
          }
          ]]>
          </mx:Script>

          <mx:Resize id="hbResize" target="{myHBox}" duration="2000"/>
          <mx:VBox>
          <mx:HBox id="myHBox" backgroundColor="#666666" borderStyle="solid" borderThickness="1" width="200" height="200"/>
          <mx:Spacer height="50"/>
          <mx:Button id="hbButton" label="Widen HBox" click="resizeHB(hbStatus);" />
          </mx:VBox>
          </mx:Application>