Data-AMF

 view release on metacpan or  search on metacpan

examples/simple_flex_rpc/SimpleFlexRPC.mxml  view on Meta::CPAN

<?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>



( run in 0.748 second using v1.01-cache-2.11-cpan-39bf76dae61 )