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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute" width="304" height="204"
xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:models="models.*" xmlns:mate="http://mate.asfusion.com/"
backgroundAlpha="0" horizontalAlign="center" verticalAlign="middle"
backgroundGradientAlphas="[0.0, 0.0]" backgroundGradientColors="[#FFFDFD, #FEFEFE]">
<mx:Canvas borderStyle="2" cornerRadius="15" width="300" height="200" horizontalCenter="-1" verticalCenter="-1" backgroundAlpha="0.0" backgroundColor="#FFFFFF">
<mx:Form id="userForm" width="300" height="85"
horizontalCenter="0" verticalCenter="-45" autoLayout="false" >
<mx:FormItem id="usernameItem" required="true" label="Username:" width="100%">
<mx:TextInput id="usernameInput" width="100%" />
</mx:FormItem>
<mx:FormItem id="passwordItem" required="true" label="Password:" width="100%" >
<mx:TextInput id="passwordInput" width="100%" />
</mx:FormItem>
</mx:Form>
<mx:Button label="Connection" x="190" y="168" width="100" height="22"
click="login()" />
</mx:Canvas>
<!--***********************************-->
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.managers.PopUpManager;
import mx.core.IFlexDisplayObject;
import mx.utils.StringUtil;
import mx.validators.StringValidator;
public function login() : void
{
//// Je pense que c'est ici que je plante
var data:Object= new Object();
data.username = this.usernameInput.text;
data.password = this.passwordInput.text;
userRemoteObject.login(data);
}
public function loginResult( result : * ) : void
{
( result == true ) ? Alert.show( "Logging user succeded!" ) :
Alert.show( result );
}
public function loginFault( faultString : String ) : void
{
Alert.show( faultString, "Error!" );
}
]]>
</mx:Script>
<!--***********************************-->
<mx:RemoteObject
id="userRemoteObject"
destination="amfphp"
source="UsersController">
<mx:method name="login" result="loginResult(event.result)"
fault="loginFault(event.fault.faultString)"/>
</mx:RemoteObject>
</mx:Application> |
Partager