2007/02/28 | Flash9中使用as3.0的call方法调FMS端函数
类别(FMS) | 评论(0) | 阅读(893) | 发表于 00:02
var fmsIP:String = "127.0.0.1";
var fmsPath:String = "rtmp://"+fmsIP+"/as3test/";
var myNC:NetConnection = new NetConnection();
var callResponder:Responder = new Responder(getResult);
myNC.objectEncoding = ObjectEncoding.AMF0;
myNC.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
function netStatusHandler(event:NetStatusEvent):void {
 switch (event.info.code) {
  case "NetConnection.Connect.Success":
  trace("连接成功!")
  myNC.call("msgFromClient",callResponder,"这是传给服务器的信息");
  break; 
  }
  }
myNC.connect(fmsPath)
function getResult(msg:String):void{
 trace("从服务器返回的整条信息:"+msg)
 }
0

评论Comments

日志分类
首页[186]
Flash[84]
FMS[41]
AIR[2]
ASP[11]
作品区[12]
其他[36]