示例 <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" verticalAlign="middle" width="340" height="250" viewSourceURL="src/DefiningStateTransitions/index.html" > <mx:Script> <![CDATA[ // You need to import easing classes even if // youre going to use them only in MXML. import mx.effects.easing.Bounce; ]]>
</mx:Script>
<!-- Use the transitions property (array) of the Application class to store your transitions. --> <mx:transitions> <!-- The "*" indicates that the transition should be applied to any changes in the view state. You can set either property to "" to refer to the base view state. --> <mx:Transition fromState="*" toState="*"> <!-- Parallel effects execute in unison --> <mx:Parallel targets="{[loginPanel, registerLink, loginButton, confirm]}"> <mx:Resize duration="500" easingFunction="Bounce.easeOut"/> <!-- Sequence effects execute in turn. The effects in this sequence will only affect the confirm FormItem. --> <mx:Sequence target="{confirm}">
<!-- The states property of the Application class defines the view states. --> <mx:states> <!-- The "Register" state is based on the base state. All states are based on the base state by default so you can leave out the basedOn property. --> <mx:State name="Register" basedOn="">
<mx:ControlBar> <!-- Use the LinkButton control to change to the Register view state. --> <mx:LinkButton label="Need to Register?" id="registerLink" click="currentState=Register" />