Mabron
05-22-2008, 03:48 AM
Problem: When using multiple instances of a FLV player in a FLA AS3 and when one navigates to another frame the video still plays from the earlier frames as one can still hear it...
I tried to implement loading a "phantom-light" FLV on the frame change to stop the video playing but I was not successful, note the code at the bottom...
What can be done?
Attach Code
function playMyFlv(){
_stream.close();
if(autoStart == "true" || is_single_file == false)
{
//player_paused = false;
toolbar.btn_play.dispatchEvent(new Event("mouseDown"));
} else {
autoStart = "true";
if(is_single_file == true){
getSingleImage();
big_play_btn.x = bg.width/2 - big_play_btn.width/2;
big_play_btn.y = bg.height/2 - big_play_btn.height/2;
big_play_btn.visible = true;
}
}
first_run=false;
toolbar.checkPlayButton();
}
function onMetaData(data:Object){
first_run=false;
if(contains(single_image_holder))removeChild(singl e_image_holder);
_timer.start();
_duration = data.duration;
_stream.soundTransform = toolbar.videoVolume;
toolbar.btn_volume.getVolume();
//resizeVideo();
}
function onNetStatus(e:NetStatusEvent){
//trace(e.info.code);
//this resets the player on movie end
if(e.info.code == "NetStream.Play.Stop"){
toolbar.resetMovie(new Event("e"));
first_run=true;
toolbar.alpha = 1;
}
if(e.info.code == "NetStream.Play.Start"){
_video.attachNetStream(_stream);
show_buffer = true;
}
if(e.info.code == "NetStream.Buffer.Empty"){
show_buffer = true;
}
if(e.info.code == "NetStream.Buffer.Full"){
show_buffer = false;
}
console.appendText(e.info.code);
resizeVideo();
}
//*************************This is the Kill Video Test Code HERE********************
/*function killdownload(){
_video.attachVideo(null);
playMyFlv.pause();
playMyFlv.play("nonexist.flv");
}
playMyFlv.onStatus = function (info) {
for (var r in info) {
trace ((r + " = ") + info[r]);
trace(my_video._height);
trace(my_video.height);
trace("-----------");
}
if(info.code == "NetStream.Play.Start"){
}
if(info.code == "NetStream.Play.Stop"){
stopping = true;
//trace("stopping");
}
if(info.code == "NetStream.Buffer.Empty" && stopping){
//trace("stopped");
}
if(info.code == "NetStream.Buffer.Full"){
if(preview){
killdownload();
}
}
};
*/
I tried to implement loading a "phantom-light" FLV on the frame change to stop the video playing but I was not successful, note the code at the bottom...
What can be done?
Attach Code
function playMyFlv(){
_stream.close();
if(autoStart == "true" || is_single_file == false)
{
//player_paused = false;
toolbar.btn_play.dispatchEvent(new Event("mouseDown"));
} else {
autoStart = "true";
if(is_single_file == true){
getSingleImage();
big_play_btn.x = bg.width/2 - big_play_btn.width/2;
big_play_btn.y = bg.height/2 - big_play_btn.height/2;
big_play_btn.visible = true;
}
}
first_run=false;
toolbar.checkPlayButton();
}
function onMetaData(data:Object){
first_run=false;
if(contains(single_image_holder))removeChild(singl e_image_holder);
_timer.start();
_duration = data.duration;
_stream.soundTransform = toolbar.videoVolume;
toolbar.btn_volume.getVolume();
//resizeVideo();
}
function onNetStatus(e:NetStatusEvent){
//trace(e.info.code);
//this resets the player on movie end
if(e.info.code == "NetStream.Play.Stop"){
toolbar.resetMovie(new Event("e"));
first_run=true;
toolbar.alpha = 1;
}
if(e.info.code == "NetStream.Play.Start"){
_video.attachNetStream(_stream);
show_buffer = true;
}
if(e.info.code == "NetStream.Buffer.Empty"){
show_buffer = true;
}
if(e.info.code == "NetStream.Buffer.Full"){
show_buffer = false;
}
console.appendText(e.info.code);
resizeVideo();
}
//*************************This is the Kill Video Test Code HERE********************
/*function killdownload(){
_video.attachVideo(null);
playMyFlv.pause();
playMyFlv.play("nonexist.flv");
}
playMyFlv.onStatus = function (info) {
for (var r in info) {
trace ((r + " = ") + info[r]);
trace(my_video._height);
trace(my_video.height);
trace("-----------");
}
if(info.code == "NetStream.Play.Start"){
}
if(info.code == "NetStream.Play.Stop"){
stopping = true;
//trace("stopping");
}
if(info.code == "NetStream.Buffer.Empty" && stopping){
//trace("stopped");
}
if(info.code == "NetStream.Buffer.Full"){
if(preview){
killdownload();
}
}
};
*/