Add a transition to use a Wipe effect and a Resize effect with an easing function to animate the transition from view state to view state
<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".
This user guide is licensed for use under the terms of the Creative Commons Attribution
Non-Commercial 3.0 License.
This License allows users to copy, distribute, and transmit the user guide for noncommercial
purposes only so long as
(1) proper attribution to Adobe is given as the owner of the user guide; and
(2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms.
The best way to provide notice is to include the following link.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
-->
<!-- transitions\LoginFormTransition.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark">
<!-- The Application class states property defines the view states.-->
<s:states>
<s:State name="default" />
<s:State name="Register" />
</s:states>
<!-- Define the transition to animate the change of view state. -->
<s:transitions>
<s:Transition fromState="default">
<s:Parallel>
<mx:Resize target="{loginPanel}" duration="100" />
<s:Wipe direction="right" target="{confirm}" />
</s:Parallel>
</s:Transition>
<s:Transition fromState="Register">
<s:Sequence>
<mx:Resize target="{loginPanel}" duration="100" />
</s:Sequence>
</s:Transition>
</s:transitions>
<!-- Set title of the Panel container based on the view state.-->
<s:Panel id="loginPanel" title="Login" title.Register="Register">
<s:layout>
<s:VerticalLayout />
</s:layout>
<mx:Form id="loginForm">
<mx:FormItem label="Username:">
<s:TextInput />
</mx:FormItem>
<mx:FormItem label="Password:">
<s:TextInput />
</mx:FormItem>
<!--
Add a TextInput control to the form for the Register view state.
-->
<mx:FormItem id="confirm" label="Confirm:" includeIn="Register">
<s:TextInput id="myTI" />
</mx:FormItem>
<mx:FormItem direction="horizontal">
<!-- Use the LinkButton to change to the Register view state.-->
<!-- Exclude the LinkButton from the Register view state.-->
<!-- Add a LinkButton to the form for the Register view state. -->
<mx:LinkButton label="Return to Login" includeIn="Register"
click="currentState=''" />
<mx:Spacer width="100%" id="spacer1" />
<!-- Set label of the control based on the view state.-->
<mx:LinkButton id="registerLink" includeIn="default"
label="Need to Register?" click="currentState='Register'" />
<s:Button id="loginButton" label="Login" label.Register="Register" />
</mx:FormItem>
</mx:Form>
</s:Panel>
</s:Application>
Related examples in the same category