2010-06-30 100 views
1

我花了2個小時在這個簡單的狀態狀態轉換,只需調整大小和移動動畫....我可以讓元素移動和淡入淡出......但根本沒有調整大小動畫。面板元素始終保持相同的寬度。如果我將代碼複製到一個全新的測試mxml文件中,它可以工作,但不在我的主應用程序文件中......我想知道是否有人可以幫助我。非常感謝。沮喪的動畫問題

//This is a custom component inside the main application...Not sure if it relates to my issue..... 

<mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx" width="1000" height="600" xmlns:getcomplist="services.getcomplist.*" xmlns:components="components.*" 
currentState="defaultState"> 

<fx:Script> 
<![CDATA[ 

    protected function compList_changeHandler(event:IndexChangeEvent):void 
    { 
     currentState="whenClick"; 
    } 

]]> 
</fx:Script> 

<mx:states> 
<s:State name="defaultState"/> 
<s:State name="whenClick" /> 
</mx:states> 

<mx:transitions> 
<s:Transition toState="whenClick"> 

<s:Parallel target="{animationIsAnnoying}"> 
<!--<s:Fade duration="1000"/>--> // Fade is working fine... 
<s:Resize heightFrom="600" duration="5000" /> //resize is not working 
<s:Move xFrom="500" duration="5000" /> //Move is working fine 
</s:Parallel> 

</s:Transition> 
</mx:transitions> 


<s:HGroup> 

<s:List id="compList" 
width="280" 
height="500" 
change="compList_changeHandler(event)"> 
</s:List> 


<s:Panel id="animationIsAnnoying" height="150" includeIn="whenClick" /> //The panel I want to animated... 


<components:compDisplayDetail includeIn="whenClick" id="compDisplay" width="600" height="500" userPic="{userPicResult.lastResult}" dataFromClick ="{compDetailinfoResult.lastResult}" /> 

</s:HGroup> 


</mx:Canvas> 

回答

1

你必須有一個click事件在這裏使用MX命令調整大小組件

IM:調整組件

<mx:Resize id="resizeThis" target="{toolBoxContainer}"/> 
<mx:VBox id="toolBoxContainer" height="200" width="300" >   
       <mx:Textid="txt" text="HELLO"/> 
     </mx:VBox> 

<mx:Button id="menuImage"toolTip="Show/Hidden Menu" click="menuClickHandler(event)" toggle="true"/> 

<mx:Script> 
<![CDATA[ 
private var toggle:int =1; 
private function menuClickHandler(e:MouseEvent):void { 

       if(toggle == 0) { 

        //MoveThis.end(); 
        resizeThis.widthFrom = 0 
        resizeThis.widthTo = 46; 
        resizeThis.play(); 

       } 
       if(toggle == 1) { 

        resizeThis.end(); 
        resizeThis.widthFrom = 46 
        resizeThis.widthTo = 0; 
        resizeThis.play(); 
       } 

       if(toggle == 0) toggle = 1; 
       else toggle = 0; 

      } 
    ]]> 
    </mx:Script> 

這件事在進口或喜歡的錯誤..但我承擔你有我的觀點..

+0

我做..我的列表更改事件應該等於點擊。由於我使用狀態轉換,我相信如果狀態改變,動畫應該會啓動....我甚至嘗試了其他效果,如縮放。他們工作也不好。轉換的整個動畫是搞砸了.. :(我認爲它的Flex或FPlayer問題。謝謝雖然.. + 1 .. – FlyingCat 2010-07-01 03:51:44

+0

我的另一篇文章在Adobe .. http://forums.adobe.com/message/ 2939528#2939528 – FlyingCat 2010-07-01 04:00:36

+0

嘗試在一個按鈕中觸發動畫,然後如果它工作..那麼也許分配狀態不包括調整大小的動畫。 – Treby 2010-07-01 04:46:29