<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" verticalAlign= "middle"> <mx:Script> <!--[CDATA[ import mx.effects.easing.Bounce; private function returnLogin(event:MouseEvent):void { this.currentState = ""; } ]]--> </mx:Script> <mx:transitions> <mx:Transition> <mx:Parallel targets="{[loginPanel, registerLink, loginButton, confirm]}"> <mx:Resize duration="500" easingFunction="Bounce.easeOut"/> <mx:Sequence target="{confirm}"> <mx:Blur duration="200" blurYFrom="1.0" blurYTo="20.0"/> <mx:Blur duration="200" blurYFrom="20.0" blurYTo="1"/> </mx:Sequence> </mx:Parallel> </mx:Transition> </mx:transitions> <mx:states> <mx:State name="Register"> <mx:AddChild relativeTo="{loginForm}" position="lastChild"> <mx:FormItem id="confirm" label="确认密码:"> <mx:TextInput/> </mx:FormItem> </mx:AddChild> <mx:SetProperty target="{loginPanel}" name="title" value="注册"/> <mx:SetProperty target="{loginButton}" name="label" value="注册"/> <!--<mx:RemoveChild target="{registerLink}"/> <mx:AddChild relativeTo="{spacer1}" position="before"> <mx:LinkButton label="返会到登录" click="currentState=''"/> </mx:AddChild>--> <mx:SetProperty target="{registerLink}" name="label" value="返回到登陆"/> <mx:SetEventHandler target="{registerLink}" name="click" handlerFunction="{returnLogin}"/> </mx:State> </mx:states> <mx:Panel id="loginPanel" title="登录" fontSize="12" horizontalScrollPolicy="off" verticalScrollPolicy="off"> <mx:Form id="loginForm"> <mx:FormItem label="用户名:"> <mx:TextInput/> </mx:FormItem> <mx:FormItem label="密码:"> <mx:TextInput/> </mx:FormItem> </mx:Form> <mx:ControlBar> <mx:LinkButton id="registerLink" label="还未注册?" click="currentState= 'Register'"/> <mx:Spacer width="100%" id="spacer1"/> <mx:Button label="登录" id="loginButton"/> </mx:ControlBar> </mx:Panel> </mx:Application>