Problems removing FLV seekBar component from stage in AS2 SWF

发布于 2022-09-06 10:34:55 字数 1017 浏览 44 评论 0

I have an AS2 swf that loads FLV videos into a FLVPlayback component and attaches a seekBar component. When the video stops I unload the seek bar from the screen and set the FLVPlayback.seekBar = null. When another video is to be played I set up the seek bar again by attaching the seekBar component to the stage and assigning FLVPlayback.seekBar = newSeekBarInstance.

Here's my code -

(my_video = FLVPlayback component)

var theSeekBar = _root.attachMovie("SeekBar", "vidSeekBar", this.getNextHighestDepth());
_root.my_video.seekBar = theSeekBar;

When video has stopped -

_root.my_video.seekBar = null;
_root.vidSeekBar.handle_mc.unloadMovie();
_root.vidSeekBar.unloadMovie();
_root.vidSeekBar.removeMovieClip();

What Im noticing is that sometimes the seek bar is removed from the screen and sometimes it isnt? I cant seem to notice any pattern here. Has anyone had similar problems? Do I need to force garbage collection?

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

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

发布评论

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

评论(1

复古式 2022-09-13 10:34:55

unloadMovie() only works for clips you have loaded with loadMovie(). It will not have any effect on other stage instances.

So if you have created your instance on the stage using attachMovie(), removeMovieClip() and setting the seekBar variable to null should be enough to have it garbage collected, unless you have any more references to it (perhaps some event listeners?) somewhere else.

I agree with @duncmc though: You should consider just hiding the seekbar instead of creating and removing it over and over again.

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