<s:transitions>
一个 Transition 对象 Array,其中的每个 Transition 对象都定义一组效果,用于在视图状态发生更改时播放。
<s:fade>淡入淡出效果可设置组件的 alpha
属性的动画效果(从透明到不透明或从不透明到透明
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <s:Animate id="mover" target="{button}"> <s:SimpleMotionPath property="x" valueFrom="0" valueTo="100"/> <s:SimpleMotionPath property="y" valueTo="100"/> <s:SimpleMotionPath property="width" valueBy="20"/> </s:Animate> <s:Parallel id="transformer" target="{button}"> <s:Move xFrom="50" xTo="150" autoCenterTransform="true"/> <s:Rotate angleFrom="0" angleTo="90" autoCenterTransform="true"/> <s:Scale scaleXFrom="1" scaleXTo="2" autoCenterTransform="true"/> </s:Parallel> </fx:Declarations> <s:states> <s:State name="state1"/> <s:State name="state2"/> </s:states> <s:transitions> <s:Transition> <s:Fade targets="{[button0, button1, button2]}"/> </s:Transition> </s:transitions> <s:Button id="button" x="50" y="100" label="transforme" click="transformer.play()"/> <s:Button id="button0" label="Visible" x="100" y="0" visible="true" visible.state2="false"/> <s:Button id="button1" label="Alpha" x="100" y="50" alpha="1" alpha.state2="0.5"/> <s:Button id="button2" label="Existence" x="100" y="100" includeIn="state2"/> <s:Button label="Toggle State" click="currentState=(currentState=='state1')?'state2':'state1'"/> </s:Application>