开发者

In Flex 4, state transition doesn't resize in both directions (v2)

开发者 https://www.devze.com 2023-02-22 19:46 出处:网络
I already had another question on this issue which was successfully resolved. But now, with a slightly开发者_开发知识库 different example, I\'m stuck again.

I already had another question on this issue which was successfully resolved. But now, with a slightly开发者_开发知识库 different example, I'm stuck again.

I have two states. When I switch from A to B, it resizes correctly, but when I switch from B back to A it happens without the smooth resize transition. What am I doing wrong?

Here's my code:

      <fx:Script>
        <![CDATA[
          protected function rollOverHandler(event:MouseEvent):void
          {
            this.currentState = "AB";
          }

          protected function rollOutHandler(event:MouseEvent):void
          {
            this.currentState = "A";
          }

        ]]>
      </fx:Script>

      <fx:Declarations>
      </fx:Declarations>

      <s:states>
        <s:State name="A" />
        <s:State name="AB" />
      </s:states>

      <s:transitions>

        <s:Transition fromState="A" toState="AB" autoReverse="true">
          <s:Parallel>
            <s:AddAction target="{controls}"/>      
            <s:Resize duration="500" target="{controls}" heightFrom="0"  />
          </s:Parallel>
        </s:Transition>

        <s:Transition fromState="AB" toState="A" autoReverse="true">
          <s:Parallel>
            <s:Resize duration="500" target="{controls}" heightTo="0" />
            <s:RemoveAction target="{controls}"/>
          </s:Parallel>
        </s:Transition>

      </s:transitions>

      <s:BorderContainer width="300" 
                         backgroundColor="#eeeeee" 
                         borderVisible="false"
                         minHeight="0">
        <s:layout>
          <s:VerticalLayout gap="0"/>
        </s:layout>
        <s:VGroup id="data">
          <s:Label text="A" fontSize="40" />  
        </s:VGroup>
        <s:VGroup id="controls" 
                  clipAndEnableScrolling="true" 
                  itemCreationPolicy="immediate"
                  includeIn="AB">
          <s:Label text="B" fontSize="40" />  
        </s:VGroup>
      </s:BorderContainer>

    </s:HGroup>

Thanks in advance, Nuno


You need to use a Sequence instead of a Parallel.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号