2011-04-05 18 views
1

我已經有another question已成功解決此問題。但現在,以一個稍微不同的例子,我再次被卡住了。在Flex 4中,狀態轉換不會在兩個方向上調整大小(v2)

我有兩個狀態。當我從A切換到B時,它會正確調整大小,但是當我從B切換回A時,不會發生平滑調整大小過渡。我究竟做錯了什麼?

這裏是我的代碼:

 <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> 

由於提前, 努諾

回答

1

你需要使用一個序列,而不是並行的。

+0

哦,我的!我多麼愚蠢。對不起,這樣一個愚蠢的錯誤,並感謝您的幫助和耐心:) – nununo 2011-04-05 17:40:28

+0

我只是想補充一點,在我的情況下,問題是我沒有在過渡聲明中指定autoReverse。 – tomswift 2011-09-13 21:53:19

相關問題