我正在使用以居中徽标和菜单开头的显示器。单击其中一个菜单项时,我将徽标和菜单移到左侧,并在右侧显示数据网格。有没有办法使用缓动函数来使这个变化看起来更好?
答案 0 :(得分: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>