如果visible属性为false,播放MovieClips是否会导致性能下降?

发布于 2024-09-05 00:03:38 字数 94 浏览 9 评论 0原文

如果我有一个 MovieClip,其“visible”属性设置为“false”,那么“stop()”其时间线是否有助于性能?或者这不会有任何影响,因为它没有被渲染,无论如何?

If I have a MovieClip with its "visible" property set to "false", would it aid performance to "stop()" its timeline? Or will that have no effect, since its not being rendered, anyway?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

┼── 2024-09-12 00:03:38

通过将visible属性设置为false,Flash将不会渲染影片剪辑。根据我们讨论的影片剪辑的数量,这可能会对 swf 的性能产生重大影响。然而,这只是其中的一部分......如果您在影片剪辑内部执行代码(即循环、事件侦听器等),那么设置其可见属性将不会阻止该代码执行。同样,根据我们讨论的影片剪辑的数量,仔细管理影片剪辑中存在的任何代码可能符合您的利益(即,除非需要,否则不要执行代码)。祝你好运!

By setting the visible property to false Flash will not render the movieclip. Depending on how many movieclips we're talking about this can have a significant impact on the performance of your swf. However, that's only part of it... if you have code executing inside of the movieclip (i.e. loops, event listeners, etc) then setting its visible property will do nothing to keep that code from executing. Again, depending on how many movieclips we're talking about it will likely be in your interest to manage any code that exists inside the movieclip carefully (i.e. don't execute code unless it needs to be). Good luck!

影子是时光的心 2024-09-12 00:03:38

您的性能将会受到影响,因为视频文件仍在由 Flash 处理,即使只是处理时间线信息。此外,如果视频正在流式传输(或逐步下载),您的性能将会受到影响,因为您会不断下载视频文件信息、更新所有缓冲区信息等。

无论何时,幕后都会发生很多事情你正在播放视频。如果可能的话,我肯定会stop()该视频。

编辑

另外,所有触发的事件、添加的事件侦听器以及视频未隐藏时在幕后调用的方法仍将被调用。视频属性不会使所有正在执行的处理逻辑停止。

You're going to get a performance hit because the video file is still being processed by Flash, even if just for timeline information. Also, if the video is being streamed (or progressively downloaded) you're going to get a performance hit because you're constantly downloading the video file information, updating all the buffer information, etc.

There's a lot going on behind the scenes whenever you're playing a video. I would definitely stop() the video if at all possible.

Edit

Plus, all the events that get fired, event listeners that are added and methods that are called behind the scenes when the video is not hidden will still be called. The video property doesn't make all the processing logic being executed cease.

榆西 2024-09-12 00:03:38

如果影片剪辑的时间轴上存在动作,则停止它会节省处理器的少量资源(即使是不可见的影片剪辑也可以处理帧动作)。

我认为如果 MovieClip 很简单(图形或矢量动画)并且没有很多与之相关的代码,那么不会有太大区别。

If you have actions present on the MovieClip's timeline, stopping it would have a minor savings on processor (even an invisible movieclip can be processing frame actions).

I don't think there would be much difference if the MovieClip is simple (graphics or vector animation) doesn't have a lot of code associated with it.

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