application.onAppStart=function ()
{
this.myNC=new NetConnection();
this.myNC.onStatus=NC_onStatus;
this.myNC.onBWDone=NC_onBWDone;
this.myNC.connect("rtmp://192.168.0.86/tsubasa");
trace("Start");
};
function NC_onStatus(info)
{
switch(info.code)
{
case "NetConnection.Connect.Success":
application.myStream=Stream.get("stream");
application.myStream.onStatus=NS_onStatus;
if(application.myStream)
{
application.myStream.play("stream",-2, -1,false,application.myNC);
trace("myStream=>play");
}
trace("连接成功!");
break;
case "NetConnection.Connect.Failed":
trace("连接失败!");
break;
case "NetConnection.Connect.Rejected":
trace("连接被拒绝!");
break;
default:
trace("连接信息 "+info.code);
break;
}
}
function NS_onStatus(info)
{
trace("视频流 "+info.code);
}
function NC_onBWDone(obj)
{
trace("NC_onBWDone");
}
原文地址:http://www.cnblogs.com/fuland/p/3817819.html