LinkButton for changing the state
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:states> <mx:State name="register"> <mx:AddChild relativeTo="{form1}" position="lastChild"> <mx:FormItem label="Enter password again:"> <mx:TextInput id="passwordInput2"/> </mx:FormItem> </mx:AddChild> <mx:SetProperty target="{stateButton}" name="label" value="Return to login"/> <mx:SetEventHandler target="{stateButton}" name="click" handler="currentState=''"/> <mx:SetProperty target="{panel1}" name="title" value="Registration Form"/> </mx:State> </mx:states> <mx:Panel title="Log In Form" id="panel1"> <mx:Form id="form1"> <mx:FormItem label="User Name:"> <mx:TextInput id="userNameInput"/> </mx:FormItem> <mx:FormItem label="Password:"> <mx:TextInput id="passwordInput"/> </mx:FormItem> </mx:Form> <mx:ControlBar id="controlbar1"> <mx:Button label="Log In"/> <mx:Spacer width="100%"/> <mx:LinkButton label="Register as new user" id="stateButton" click="currentState='register'" /> </mx:ControlBar> </mx:Panel> </mx:Application>