在Flex 4中,状态转换不会在两个方向上调整大小(v2) [英] In Flex 4, state transition doesn't resize in both directions (v2)

查看:156
本文介绍了在Flex 4中,状态转换不会在两个方向上调整大小(v2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已有另一个问题在这个问题上已经成功解决了。但现在,稍微有点不同的例子,我又被卡住了。

我有两个状态。当我从A切换到B时,它正确调整大小,但是当我从B切换回A时,没有平滑调整大小过渡。我在做什么错了?

这是我的代码:

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


保护函数rollOutHandler(event:MouseEvent):void
{
this.currentState =A;
}

]]>
< / fx:Script>

< fx:声明>
< / fx:声明>

< s:州>
< s:国家名称=A/>
< / s:州>

< s:转换>

< s:Parallel>
< s:Resize duration =500target ={controls}heightFrom =0/>
< / s:Parallel>
< / s:转换>

< s:Parallel>
< s:Resize duration =500target ={controls}heightTo =0/>
< s:RemoveAction target ={controls}/>
< / s:Parallel>
< / s:转换>

< / s:转换>

backgroundColor =#eeeeee
borderVisible =false
minHeight =0>
< s:layout>
< s:VerticalLayout gap =0/>
< / s:layout>
< / s:VGroup>
clipAndEnableScrolling =true
itemCreationPolicy =immediate
includeIn =AB>
< / s:VGroup>
< / s:BorderContainer>

< / s:HGroup>

在此先感谢,
Nuno

解决方案

您需要使用序列而不是并行。


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.

这篇关于在Flex 4中,状态转换不会在两个方向上调整大小(v2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆