我如何知道玩家何时停止玩游戏?
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"
信息代码。为什么?
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);
}
If the video ended playing its not tracing "NetStream.Play.Stop"
info code. Why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要查看 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 所示)。
You need to look at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#event:onPlayStatus
From Adobe:
Establishes a listener to respond when a NetStream object has completely played a stream. The associated event object provides information in addition to what's returned by the netStatus event. You can use this property to trigger actions in your code when a NetStream object has switched from one stream to another stream in a playlist (as indicated by the information object NetStream.Play.Switch) or when a NetStream object has played to the end (as indicated by the information object NetStream.Play.Complete).