2007/01/25 | AS3.0连接FMS2.0测试
类别(FMS) | 评论(2) | 阅读(1232) | 发表于 00:56

var fmsIP:String = "127.0.0.1";
var fmsPath:String = "rtmp://"+fmsIP+"/audioOnLine_fms/";
var myNC:NetConnection = new NetConnection();
myNC.objectEncoding = ObjectEncoding.AMF0;
myNC.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
myNC.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
function netStatusHandler(event:NetStatusEvent):void {
 switch (event.info.code) {
  case "NetConnection.Connect.Success":
  trace("连接成功!")
  getStream();
  break;
  case "NetStream.Play.StreamNotFound":
  trace("未找到视频文件: " + videoURL);
  break;
  }
  }
function securityErrorHandler(event:SecurityErrorEvent):void {
 trace("安全沙箱错误侦听: " + event);
 }
function getStream():void {
 var myNS:NetStream = new NetStream(myNC);
 myNS.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
 movie.Live_video.attachNetStream(myNS);
 myNS.play("1");
 }
myNC.connect(fmsPath)

0

评论Comments

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