标签:
客户端as:
1 import flash.net.NetConnection; 2 import flash.events.NetStatusEvent; 3 4 var nc:NetConnection = new NetConnection(); 5 nc.addEventListener(NetStatusEvent.NET_STATUS,onStatus); 6 nc.connect("rtmp://localhost/HelloWorld","小明"); 7 function onStatus(e:NetStatusEvent):void 8 { 9 trace(e.info.code); 10 switch (e.info.code) 11 { 12 case "NetConnection.Connect.Success" ://连接尝试成功 13 14 break; 15 case "NetConnection.Connect.Closed" ://成功关闭连接 16 17 break; 18 case "NetConnection.Connect.Rejected"://服务器拒绝连接 19 for(var key in e.info.application){ 20 trace("服务器返回的信息:",e.info.application[key]); 21 } 22 break; 23 default : 24 break; 25 } 26 }
服务器asc:
1 application.onConnect = function( client,name ) { 2 if(name == "小明"){ 3 // Reject the connection. 4 application.rejectConnection(client,{msg:"服务器拒绝"+name+"进入!"}); 5 }else{ 6 // Accept the connection. 7 application.acceptConnection( client ); 8 } 9 }
[ActionSprit 3.0] FMS客户端与服务器端交互(传参)
标签:
原文地址:http://www.cnblogs.com/frost-yen/p/4649054.html