Client as:
1 Importflash.net.NetConnection;2 Importflash.events.NetStatusEvent;3 4 varNc:netconnection =Newnetconnection ();5 Nc.addeventlistener (netstatusevent.net_status,onstatus);6Nc.connect ("Rtmp://localhost/helloworld","Xiao Ming");7 functionOnstatus (e:netstatusevent):void8 {9 Trace (e.info.code);Ten Switch(E.info.code) One { A Case "NetConnection.Connect.Success"://connection attempt succeeded - - Break; the Case "NetConnection.Connect.Closed"://successfully closed connection - - Break; - Case "NetConnection.Connect.Rejected"://Server denied connection + for(varKeyinche.info.application) { -Trace"Information returned by the server:", E.info.application[key]); + } A Break; at default : - Break; - } -}
Server ASC:
1Application.onconnect =function(client,name) {2 if(Name = ="Xiao Ming"){3 //Reject the connection.4Application.rejectconnection (client,{msg:"Server Reject"+name+"Enter! "});5}Else{6 //Accept the connection.7 application.acceptconnection (client);8 }9}
[Actionsprit 3.0] FMS Client-Server interaction (parameter transfer)