<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:states> <mx:State name="Manager"> <mx:RemoveChild target="{ID_LOGIN_PANEL}"/> <mx:AddChild position="lastChild"> <mx:Canvas x="0" y="0" width="100%" height="62" id="ID_TOP"> </mx:Canvas> </mx:AddChild> <mx:AddChild position="lastChild"> <mx:HDividedBox x="0" y="70" height="100%" width="100%"> <mx:Box id="ID_LEFT" backgroundColor="haloGreen" width="20%" height="100%" minWidth="100" > </mx:Box> <mx:Box id="ID_RIGHT" backgroundColor="haloBlue" width="80%" height="100%" minWidth="100"> </mx:Box> </mx:HDividedBox > </mx:AddChild> </mx:State> </mx:states> <mx:Panel width="400" height="250" layout="absolute" horizontalCenter="0" verticalCenter="4" title="Login" id="ID_LOGIN_PANEL"> <mx:Label text="User:" id="ID_USER_LABEL" x="56" y="49"/> <mx:Label x="56" y="93" text="Pass:" id="ID_PASS_LABEL"/> <mx:TextInput x="110" y="47" width="200" id="ID_USER_EDIT"/> <mx:TextInput x="110" y="91" width="200" displayAsPassword="true" id="ID_PASS_EDIT"/> <mx:Button x="227" y="134" label="Login" width="83" id="ID_LOGIN_BUTTON" click="loginHandle()"/> </mx:Panel> <mx:HTTPService id="userLogin" url="http://localhost/flex/login.php" method="POST" showBusyCursor="true" result="getLoginResult(event)"> <mx:request xmlns=""> <mx:ID_USER_EDIT> {ID_USER_EDIT.text} </mx:ID_USER_EDIT> <mx:ID_PASS_EDIT> {ID_PASS_EDIT.text} </mx:ID_PASS_EDIT> </mx:request> </mx:HTTPService> <mx:Script> <!--[CDATA[ import mx.rpc.events.ResultEvent; import mx.controls.Alert; private function loginHandle():void { var user:String = this.ID_USER_EDIT.text; var pass:String = this.ID_PASS_EDIT.text; if( user == "" ) { //Alert.show("用户名不能为空!"); } if( pass == "" ) { //Alert.show("密码不能为空!"); } userLogin.send(); } public function getLoginResult(event:ResultEvent):void { Alert.show(event.message.body.toString()); currentState='Manager'; } ]]--> </mx:Script> </mx:Application> <?php print_r($_POST); ?>