我如何知道玩家何时停止玩游戏?

发布于 2024-12-06 15:49:26 字数 1033 浏览 0 评论 0原文

        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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妥活 2024-12-13 15:49:26

您需要查看 http: //help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#event:onPlayStatus

来自 Adob​​e:

建立一个侦听器以在 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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文