<?xml version="1.0" encoding="utf-8"?>
    
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()"  frameRate="20">

<mx:RemoteObject id="jojuservice"
    fault="faultHandler(event)"
    showBusyCursor="true"
    source="joju.World"
    destination="zend" >

	<mx:method name="getWorld" result="getWorldHandler(event)" />
	<mx:method name="hello" />
	
</mx:RemoteObject>
	
	<mx:Script>
		<![CDATA[
    		import mx.rpc.events.FaultEvent;
    		import mx.rpc.events.ResultEvent;
    		import mx.controls.Alert;
    		import joju.World;
			
    		private var main:Main;
						
    		public function onCreationComplete():void
    		{
     			main = new Main( jojuservice );
//    			jojuservice.getWorld();
    		}

    		public function getWorldHandler(event:ResultEvent):void
			{
				main.setWorld( World( event.result ) ); 
			}
			
    		private function faultHandler(fault:FaultEvent):void
    		{
    			Alert.show("error" + fault.fault.message);
    		}
			
		]]>
	</mx:Script>
	
</mx:Application>
