Is there any great memory or CPU difference for the following 2 bits of code? Basically hiding an flv or completely removing it, then reloading it when required.
Option 1 (hide)
public function stopFlyby():void {
flvPlaybak.seek(0);
flvPlaybak.stop();
flvPlaybak.visible = false;
}
then to see again
public function playFlyby():void {
flvPlaybak.visible = true;
flvPlaybak.play();
}
Option 2 (remove)
public function stopFlyby():void {
flvPlaybak.seek(0);
flvPlaybak.stop();
removeChild(flvPlaybak);
flvPlaybak = null;
}
public function playFlyby():void {
flvPlaybak = new FLVPlayback();
//load flv...
addChild(flvPlaybak);
flvPlaybak.play();
}
Thanks,
Mark
I am no expert on the subject but since no one has answered yet I'll throw my 2 cents in.
Option 1 has an advantage of not having to download the video file again, which for some videos could take a while; however, there's a chance the browser's cache might come to the rescue and prevent it from having to be downloaded again.
Option 2 would free up memory (whenever garbage collection feels like it of course :) and since it is a video it would likely be a good amount of memory freed up.
As far as the CPU goes I would assume the difference between the options is hardly noticeable to the end user.
I lean toward option 2, since likely after the user watches the video once they won't want to watch it again.