开发者

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?


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜