| 1 | <?xml version="1.0" encoding="utf-8"?> |
|---|
| 2 | <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> |
|---|
| 3 | |
|---|
| 4 | <mx:Script> |
|---|
| 5 | <![CDATA[ |
|---|
| 6 | import mx.utils.ObjectUtil; |
|---|
| 7 | import mx.rpc.events.ResultEvent; |
|---|
| 8 | import mx.controls.Alert; |
|---|
| 9 | import mx.rpc.events.FaultEvent; |
|---|
| 10 | |
|---|
| 11 | private function faultHandler(fault:FaultEvent):void |
|---|
| 12 | { |
|---|
| 13 | Alert.show(fault.fault.faultString, fault.fault.faultCode.toString()); |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | private function getAllDepartmentsHandler(event:ResultEvent):void |
|---|
| 17 | { |
|---|
| 18 | Alert.show(ObjectUtil.toString(event.result)); |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | private function getService():void |
|---|
| 22 | { |
|---|
| 23 | //userService.getAllDepartments.send(); |
|---|
| 24 | userService.getAllDepartments.send(); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | ]]> |
|---|
| 29 | </mx:Script> |
|---|
| 30 | |
|---|
| 31 | <!--<mx:RemoteObject id="userService" destination="test" endpoint="http://localhost:8000/djangoswf/gateway/"> |
|---|
| 32 | <mx:method name="getAllDepartments" result="getAllDepartmentsHandler(event)" fault="faultHandler(event)"/> |
|---|
| 33 | </mx:RemoteObject>--> |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | <mx:RemoteObject id="userService" |
|---|
| 37 | source="usersGateway" |
|---|
| 38 | destination="test" |
|---|
| 39 | showBusyCursor="true"> |
|---|
| 40 | <mx:method name="getAllDepartments" result="getAllDepartmentsHandler(event)" fault="faultHandler(event)"/> |
|---|
| 41 | <mx:method name="getDepAllUsers" result="getAllDepartmentsHandler(event)" fault="faultHandler(event)"/> |
|---|
| 42 | </mx:RemoteObject> |
|---|
| 43 | |
|---|
| 44 | <mx:Label text="{Application.application.parameters.url}" fontSize="20"/> |
|---|
| 45 | |
|---|
| 46 | <mx:Button label="getService" click="getService()"/> |
|---|
| 47 | |
|---|
| 48 | </mx:Application> |
|---|