red5+flex做helloworld

package com.baidu.test;

import java.util.Map;
import java.util.Set;

import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IAttributeStore;
import org.red5.server.api.IScope;

public class Application extends ApplicationAdapter {
	
	
	public String hello(){
		return "hello";
	}
	

	public void setScope(IScope arg0) {
		// TODO Auto-generated method stub

	}

	public Object getAttribute(String arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public Object getAttribute(String arg0, Object arg1) {
		// TODO Auto-generated method stub
		return null;
	}

	public Set<String> getAttributeNames() {
		// TODO Auto-generated method stub
		return null;
	}

	public Map<String, Object> getAttributes() {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean hasAttribute(String arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean removeAttribute(String arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	public void removeAttributes() {
		// TODO Auto-generated method stub

	}

	public boolean setAttribute(String arg0, Object arg1) {
		// TODO Auto-generated method stub
		return false;
	}

	public void setAttributes(Map<String, Object> arg0) {
		// TODO Auto-generated method stub

	}

	public void setAttributes(IAttributeStore arg0) {
		// TODO Auto-generated method stub

	}

}

 然后我门在来看as这边

package {
	import flash.display.Sprite;
	import flash.events.NetStatusEvent;
	import flash.net.NetConnection;
	import flash.net.ObjectEncoding;
	import flash.net.Responder;

	public class TT extends Sprite
	{
		private var nc:NetConnection;
		
		public function TT()
		{
			nc=new NetConnection();
			nc.objectEncoding=ObjectEncoding.AMF0;
//			nc.objectEncoding = ObjectEncoding.AMF0;
			nc.addEventListener(NetStatusEvent.NET_STATUS,start);
			nc.connect("rtmp://localhost:1935/Red5TT");
			var response:Responder=new Responder(reslt,error);
			nc.call("hello",response);
			
		}
		
		public function start(evt:NetStatusEvent):void{
			
			trace( "连接信息……..\n"+evt.info.code);
			if (evt.info.code == "NetConnection.Connect.Rejected" ){
			trace( evt.info.application );
			}
		}
		
		private function reslt(rs:Object):void{
			trace("服务端返回结果为:….."+rs);
		}
		private function error(err:Object):void{
			trace("连接错误:….."+err);
		}		
		
		
	}
}

 

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