main.asc:
1. application.onAppStart=function()
2. {
3. trace("fms服务器启动......");
4. };
5.
6.
7. application.onConnect=function(client)
8. {
9. this.acceptConnection(client);
10. client.sayH=function(str){
11. return "I can say:Hello "+ str;
12. };
13.
14. };
复制代码
客户端相关代码:
1. private var nc:NetConnection;
2. private var rtmpUrl:String="rtmp://localhost/test";
3. private var rsp:Responder;
4. private var ns:NetStream;
5. private function onConn():void{
6. nc=new NetConnection();
7. nc.connect(rtmpUrl);
8. nc.client=this;
9. rsp=new Responder(onSuc,onFail);
10. nc.call("sayH",rsp,"World");
11. nc.addEventListener(NetStatusEvent.NET_STATUS,conS);
12. nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR,conF);