public function videoPlayer()
{
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
connection.connect(null);
}
private function connectStream():void
{
stream= new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
stream.client = this;
stream.bufferTime = 30;
video = new Video(600,313);
video.attachNetStream(stream);
stream.play(vName);
addChild(video);
}
}
private function netStatusHandler(event:NetStatusEvent):void
{
trace(event.info.code);
}
如果视频结束播放,它不跟踪"NetStream.Play.Stop"
信息代码。为什么?
您需要查看http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#event:onPlayStatus
从Adobe:建立一个监听器,当NetStream对象完全播放完一个流时进行响应。除了netStatus事件返回的信息外,关联的事件对象还提供信息。当NetStream对象在播放列表中从一个流切换到另一个流时(如信息对象NetStream. play . switch所示),或者当NetStream对象播放到结束时(如信息对象NetStream. play . complete所示),您可以在代码中使用此属性来触发动作。