Videos playing at the same time

Hello everybody,

I’m a new member on this forum and would like to get some advice on some actionscript issues regarding loaded videos inside movieclips.

I have several small (flv) movies all inside their own movieclips which also contains some animations too.

When I use my buttons to play and stop the movies from the main timeline, everything is fine, but when I want to jump to a different movie with a gotoAndPlay button, I sometimes get 2 or 3 movies and audio playing at the same time.

I heard about removing a stage listener to stop each video, but that would mean to add and remove listeners constantly. Is there a better way and easier than using something like netstream.

thanks in advance,

Here’s my code if it can help.

import fl.video.*;

navbar.visible = true;

navbar.addEventListener(MouseEvent.MOUSE_OVER, showmenu);
function showmenu(e:MouseEvent):void{

        • navbar.alpha = 1;
          }

navbar.addEventListener(MouseEvent.MOUSE_OUT, hidemenu);
function hidemenu(e:MouseEvent):void{

        • navbar.alpha = 0;
          }

navbar.next_btn.addEventListener(MouseEvent.CLICK, nextButtonClick);
navbar.prev_btn.addEventListener(MouseEvent.CLICK, previousButtonClick);
navbar.play_btn.addEventListener(MouseEvent.CLICK, playButtonClick);
navbar.stop_btn.addEventListener(MouseEvent.CLICK, stopButtonClick);
navbar.menu_btn.addEventListener(MouseEvent.CLICK, menuButtonClick);

function stopButtonClick(e:MouseEvent):void
{

if(delay1)

{
delay1.VidDesign1.stop();
delay1.stop();
}

else if (delay2)

{
delay2.Video2.stop();
delay2.stop();
}

else if (delay3)

{
delay3.VidDesign3.stop();
delay3.stop();
}

else if (delay4)

{
delay4.VidDesign4.stop();
delay4.stop();
}

else if (analysis1)

{
analysis1.VidDesign5.stop();
analysis1.stop();
}

 else if (analysis2)

{
analysis2.VidDesign6.stop();
analysis2.stop();
}

 else if (analysis3)

{
analysis3.VidDesign7.stop();
analysis3.stop();
}

stop();
}

function playButtonClick(e:MouseEvent):void
{
if(delay1)
{
delay1.VidDesign1.play();
delay1.play();
}

else if(delay2)

{
delay2.VidDesign2.play();
delay2.play();
}

else if(delay3)

{
delay3.VidDesign3.play();
delay3.play();
}

else if(delay4)

{
delay4.VidDesign4.play();
delay4.play();
}

else if (analysis1)

{
analysis1.VidDesign5.play();
analysis1.play();
}

else if (analysis2)

{
analysis2.VidDesign6.play();
analysis2.play();
}

else if (analysis3)

{
analysis3.VidDesign7.play();
analysis3.play();
}

play();

}

function previousButtonClick(e:MouseEvent):void
{

if(delay1)

{
delay1.VidDesign1.stop();
delay1.stop();
}

else if  (delay2)

{
delay2.Video2.stop();
delay2.stop();
gotoAndPlay(“delay1”);
}

else if  (delay3)

{
delay3.VidDesign3.stop();
delay3.stop();
gotoAndPlay(“delay2”);
}

else if (delay4)

{
delay4.VidDesign4.stop();
delay4.stop();
gotoAndPlay(“delay3”);
}

 else if (analysis1)

{
analysis1.VidDesign6.stop();
analysis1.play();

}

 else if (analysis2)

{
analysis2.VidDesign7.play();
analysis2.play();
gotoAndPlay(“analysis1”);
}

 else if (analysis3)

{
analysis3.VidDesign7.stop();
analysis3.stop();
gotoAndPlay(“analysis2”);

}

gotoAndStop(currentFrame - 250);

}

function nextButtonClick(e:MouseEvent):void
{

if(delay1)

{
delay1.VidDesign1.stop();
delay1.stop();
gotoAndPlay(“delay2”);
}

else if(delay2)

{
delay2.VidDesign2.stop();
delay2.stop();
gotoAndPlay(“delay3”);
}

else if (delay3)

{
delay3.VidDesign3.stop();
delay3.stop();
gotoAndPlay(“delay4”);
}

 else if (delay4)

{
delay4.VidDesign4.stop();
delay4.stop();
}

  else if (analysis1)

{
analysis1.VidDesign5.stop();
analysis1.stop();
gotoAndPlay(“analysis2”);
}

 else if (analysis2)

{
analysis2.VidDesign6.stop();
analysis2.stop();
gotoAndPlay(“analysis3”);
}

 else if (analysis3)

{
analysis3.VidDesign7.stop();
}

gotoAndStop(currentFrame + 250);	

}

function menuButtonClick(e:MouseEvent):void
{

if(delay1)

{
delay1.stop();
}

else if (delay2)

{
delay2.stop();
}

else if (delay3)

{
delay3.stop();
}

 else if (delay4)

{
delay4.stop();
}

 else if (analysis1)

{
VidDesign5.stop();
}

 else if (analysis2)

{
VidDesign6.stop();
}

 else if (analysis3)

{
VidDesign7.stop();
}

gotoAndPlay(1);

}

Been a while since I’ve done any flash so this may not be the best solution but…

I don’t think you’re stopping the video when the user navigates away from the video are you? I would create somewhat of a global stop function to call whenever a user navigates away from a certain video. Call the global stop whenever a user navigates and it will in essence stop() every video (even if it’s not playing)

Well in essence yes the video should stop when the user clicks on the (next)
button or the (back) button and either start playing the next video or some other animation in the main timeline.

I could however put a stop on the movieclip’ animation and have the video be on autoplay =false.

But then I would need to trigger it back on with the play button.

Everything works fine as long as I don’t use the gotoAndPlay // next frame.

But the client (user) wants to be able to jump back and forth through the videos