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
|
<?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:RemoteObject id="helloService"
endpoint="http://localhost:5000/amf/gateway"
destination="perlamf"
source="HelloController"
showBusyCursor="true"
result="log(event.result);"
fault="log(event.fault.faultDetail)"
/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.utils.ObjectUtil;
private function log(... rest):void
{
var args:Array = rest;
var str:String = '';
for each (var argument:* in args)
{
if (argument is String)
str += argument + ' ';
else
str += ObjectUtil.toString(argument);
}
if (result.text != '')
result.text += "\n";
trace(str)
result.text += str;
}
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout
paddingTop="15"
paddingLeft="15"
paddingBottom="15"
paddingRight="15"
/>
</s:layout>
<s:Label text="RemoteObject With Perl" fontSize="12" fontWeight="bold" />
<s:Button label="reset" click="result.text = ''" />
<s:Button label="add(1, 2)" click="helloService.add(1, 2)" />
<s:Button label="echo(new Date(), [1, 2])" click="helloService.echo(new Date(), [1, 2])" />
<s:Button label="list(10)" click="helloService.list(10)" />
<s:Scroller width="100%" height="100%">
<s:Group>
<s:layout>
<s:VerticalLayout
paddingTop="5"
paddingLeft="5"
paddingBottom="5"
paddingRight="5"
/>
</s:layout>
<s:RichText id="result" />
</s:Group>
</s:Scroller>
</s:Application>
|