madmac66
03-07-2008, 07:00 PM
Hi, I have an instance of the FLVPlayback Component on my stage that is populated by ActionScript. I have a button that when clicked loads 1 of 3 possible FLVs using contentPath() property. When the FLV is complete, I have a listener that unloads the movie and initiates the menu once more.
Everything works fine the first time round. however once the movie has been unloaded, no other movie can be loaded in. If I use stop() with the listener in place of unload movie, further FLVs can be successfully loaded in, but obviously this looks terrible as I have the menu viewing over the frame of video.
So, how do i successfully unload an FLV then load another back in?
I have menu_mc on the root timeline that has all the code that looks like this... the variables that decide which FLV to load (nextSeg) are created on a previous frame.
stop();
import mx.video.*;
trace("playing:"+nextSeg);
_root.main_flv.load("video/"+nextSeg+".flv");
_root.main_flv.play();
//_root.main_flv.contentPath = "video/"+nextSeg+".flv";
_root.return_btn._visible = true;
_root.replay_btn._visible = false;
var listenerObject:Object = new Object();
listenerObject.ready = function() {
menuCube_mc._visible = false;
}
listenerObject.complete = function() {
_root.main_flv.unloadMovie();
menuCube_mc._visible = true;
_root.menu_mc.gotoAndPlay(1);
}
_root.main_flv.addEventListener("ready", listenerObject);
_root.main_flv.addEventListener("complete", listenerObject);
Everything works fine the first time round. however once the movie has been unloaded, no other movie can be loaded in. If I use stop() with the listener in place of unload movie, further FLVs can be successfully loaded in, but obviously this looks terrible as I have the menu viewing over the frame of video.
So, how do i successfully unload an FLV then load another back in?
I have menu_mc on the root timeline that has all the code that looks like this... the variables that decide which FLV to load (nextSeg) are created on a previous frame.
stop();
import mx.video.*;
trace("playing:"+nextSeg);
_root.main_flv.load("video/"+nextSeg+".flv");
_root.main_flv.play();
//_root.main_flv.contentPath = "video/"+nextSeg+".flv";
_root.return_btn._visible = true;
_root.replay_btn._visible = false;
var listenerObject:Object = new Object();
listenerObject.ready = function() {
menuCube_mc._visible = false;
}
listenerObject.complete = function() {
_root.main_flv.unloadMovie();
menuCube_mc._visible = true;
_root.menu_mc.gotoAndPlay(1);
}
_root.main_flv.addEventListener("ready", listenerObject);
_root.main_flv.addEventListener("complete", listenerObject);