Hi,
I am having difficulties to remove my FLVPlayback and FLVPlaybackCaptioning components from stage.
Could anyone possibly help me out, please?
In my project I have a list of content objects which I want to play one after the other. A new content object is loaded after the user clicks on a button.
Those content objects may be external swf files (which doesn’t seem to be a problem) or flv videos using the FLVPlayback and FLVPLaybackCaptioning components.
I am adding those two components to my stage pretty much like described in the AS3 reference manual. Before loading the next content object, I stop the video like this:
try {
// if video component 'player' exists then remove it
if (player && player.bytesLoaded > 0) {
player.stop();
captioning.source = null;
captioning.removeEventListener(CaptionChangeEvent.CAPTION_CHANGE, onCaptionChange);
captioning.removeEventListener(IOErrorEvent.IO_ERROR, noCaptionFile);
if ((player.source != null) && (player.source != "")) {
var vp = player.getVideoPlayer(player.activeVideoPlayerIndex);
vp.close();
}
// try to place it outside the stage
player.x = 1050;
captioning.x = 1050;
}
}
catch (obj) {}
I am also removing both player and captioning from stage (using removeChild).
Still, the video player controls and the captioning text remains on stage.
How do I get rid of them?
Which way is better: destroying player and captioning instances after each video and creating new ones every time or just closing the video player inside the player component and placing both components outside the stage until I need them again?
Thanks a lot!