1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| <?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<fx:Declarations>
<s:HTTPService id="userRequest" url="http://localhost/Flex.php"
useProxy="false" method="GET" result="HTTPResultHandler(event)">
</s:HTTPService>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
private function Login():void
{
var objParam:Object = { };
objParam['key'] = txtKey.text;
userRequest.resultFormat = "e4x";
userRequest.useProxy = false;
userRequest.addEventListener(FaultEvent.FAULT , function(event:FaultEvent):void {Alert.show(event.fault.toString())});
userRequest.send(objParam);
}
private function HTTPResultHandler(event:ResultEvent):void
{
Alert.show(event.message.body.toString());
}
]]>
</fx:Script>
<s:HGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="center">
<s:TextInput id="txtKey" text="001" maxChars="10"></s:TextInput>
<s:Button label="Login" click="Login()"></s:Button>
</s:HGroup>
</s:Application> |