Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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/mx" minWidth="955" minHeight="600" creationComplete="init()">
- <fx:Script>
- <![CDATA[
- import com.jfawcett.models.UserVO;
- import mx.controls.Alert;
- private var currentUser:UserVO;
- private var connection:NetConnection;
- private var gateway:String = "http://localhost/gateway/";
- private function init():void
- {
- connection = new NetConnection();
- connection.connect(gateway);
- }
- protected function loginButton_clickHandler(event:MouseEvent):void
- {
- var responder:Responder = new Responder(loginResult, onFault);
- connection.call("AuthService.login", responder, txtUsername.text, txtPassword.text);
- }
- private function onFault(data:Object):void
- {
- Alert.show( "Service Error" );
- }
- private function loginResult(user:UserVO):void {
- currentUser = user;
- Alert.show( "Groups: " + currentUser.groups);
- }
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
- <mx:Accordion width="20%" height="100%">
- <s:NavigatorContent label="Login">
- <mx:Form id="loginForm">
- <mx:FormItem id="username">
- <mx:FormItemLabel text="Username:" />
- <s:TextInput id="txtUsername" />
- </mx:FormItem>
- <mx:FormItem>
- <mx:FormItemLabel text="Password:" />
- <s:TextInput id="txtPassword" displayAsPassword="true" />
- </mx:FormItem>
- <mx:FormItem>
- <s:Button id="loginButton" click="loginButton_clickHandler(event)" label="Login" />
- </mx:FormItem>
- </mx:Form>
- </s:NavigatorContent>
- </mx:Accordion>
- </s:Application>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement