2011-05-28 157 views
0

我正在使用居中的徽标和菜单开始显示。当其中一个菜单项被点击时,我将徽标和菜单移到左侧,并在右侧显示一个数据网格。有没有办法使用缓动功能来使这个改变看起来更好?Flex缓动 - 显示/隐藏窗口?

回答

2

简短的回答是:是的!为了说明它,我创建了以下示例:

<?xml version="1.0" encoding="utf-8"?> 
<s:Application minHeight="600" minWidth="955" xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"> 
    <fx:Declarations> 
     <s:Bounce id="easer1" /> 
     <s:Elastic id="easer2" /> 
    </fx:Declarations> 
    <s:states> 
     <s:State name="intro" /> 
     <s:State name="main" /> 
    </s:states> 
    <s:transitions> 
     <s:Transition fromState="intro" toState="main"> 
      <s:Sequence> 
       <s:Move disableLayout="true" easer="{easer2}" target="{menuGroup}" /> 
       <s:SetAction property="verticalCenter" target="{menuGroup}" value="{NaN}" /> 
       <s:SetAction property="horizontalCenter" target="{menuGroup}" value="{NaN}" /> 
       <s:AddAction target="{dg}" /> 
       <s:Fade easer="{easer1}" target="{dg}" /> 
      </s:Sequence> 
     </s:Transition> 
    </s:transitions> 
    <s:VGroup horizontalCenter.intro="0" id="menuGroup" left.main="10" top.main="10" verticalCenter.intro="0"> 
     <s:Label text="Logo is here" /> 
     <s:Button click="currentState = 'main'" label="Click Me!" /> 
     <s:Button click="currentState = 'main'" label="Click Me!" /> 
    </s:VGroup> 
    <mx:DataGrid bottom="10" id="dg" includeIn="main" left="{menuGroup.width + 20}" right="10" top="10"> 
     <mx:columns> 
      <mx:DataGridColumn headerText="First" /> 
      <mx:DataGridColumn headerText="Second" /> 
     </mx:columns> 
    </mx:DataGrid> 
</s:Application> 
+0

不错!非常感谢! – ethrbunny 2011-05-29 12:08:12

+0

不客气! :) – Constantiner 2011-05-29 12:10:47