2010-06-30 68 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