2011-05-28 120 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