Netconnection连接blazeds

package
{
	import flash.events.AsyncErrorEvent;
	import flash.events.NetStatusEvent;
	import flash.net.NetConnection;
	import flash.net.ObjectEncoding;
	import flash.net.Responder;
	
	import mx.core.SpriteAsset;
	
	public class As3Blazeds extends SpriteAsset
	{
		var nets:NetConnection=new NetConnection();
		public function As3Blazeds()
		{
			super();
			nets.client=this;
			nets.objectEncoding=ObjectEncoding.AMF3;
			nets.connect("http://localhost:8400/GDGWeb/messagebroker/amf");
			nets.addEventListener(NetStatusEvent.NET_STATUS,states);
			nets.addEventListener(AsyncErrorEvent.ASYNC_ERROR,asyError);
			nets.call("netTest.sayHello",new Responder(result,fault),"call blazeds");
		}
		private function asyError(v:AsyncErrorEvent):void{
			trace(v.text+"error");
		}
		private function states(event:NetStatusEvent):void{
			trace(event.info.code.toString())
		}
		private function result(data:Object):void{
			trace(data.toString());
		}
		private function fault(data:Object):void{
			trace(data.toString());
		}
		
	}
}

 

remote-config.xml
 <destination id="netTest">
    	<properties>
    		<source>cn.isvi.test.NetTest</source>
    	</properties>
 </destination>

package cn.isvi.test;

public class NetTest {
	
	public String sayHello(String args){
		System.out.println("sayHello"+args);
		return args+"sayHello";
	}
}
 

你可能感兴趣的:(.net,xml,Flash)