0 Replies Latest reply on Apr 5, 2011 11:46 PM by connectpp

    Getting height, width of component in different state

    connectpp

      Hi,

       

      I have a collapsible component that extends Panel. Also i have a skin file that implements skin for this component.

      skin file has 2 states, collapsed and expanded. I use transitions to set width to the hostComponent.

       

      When the component is initially in expanded state I use a custom property collapsedWidth to set widthTo property for resize effect in transition. This works fine.

      But when component is initially in collapsed state i want the value of widthTo property to be set depending on the contents in expanded state. currently i have variable expandedWidth and using this variable it works fine but i want to get rid of expandedWidth variable and feel that the width in expanded state should be calculated as per the contents in expanded state. how can i get the width in expanded state when i am in collapsed state.

       

      <s:states>

            <s:State name="normal"/>

            <s:State name="collapsed"/>

      </s:states>

       

      <s:transitions>

            <s:Transition fromState="*" toState="collapsed">

               <mx:Parallel duration="250" target="{hostComponent}">

                  <mx:Resize widthTo="{hostComponent.collapsedWidth }"/>

               </mx:Parallel>

            </s:Transition>

       

            <s:Transition fromState="*" toState="normal">

               <mx:Parallel duration="250" target="{hostComponent}">

                  <mx:Resize widthTo="{hostComponent.expandedWidth}"/>

                  <s:Fade alphaFrom="0" alphaTo="1"/>

               </mx:Parallel>

            </s:Transition>

      </s:transitions>

       

      My basic requirement is to remove collapsedWidth and expandedWidth.