开发者

Do playing MovieClips cause a performance hit if visible property is false?

开发者 https://www.devze.com 2023-01-03 05:32 出处:网络
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, a

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?


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!


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号