Problems removing FLV seekBar component from stage in AS2 SWF
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
unloadMovie()
only works for clips you have loaded withloadMovie()
. 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.