Skip to main content
Known Participant
January 22, 2008
Question

stop video player

  • January 22, 2008
  • 2 replies
  • 494 views
Hello,
i have a stop command on my actions layer at frame 20. There is a button on the stage that will go to frame 21 and contnue playing the timeline when pressed. I want my video which starts on frame 1 to stop once the go to frame 21 button has been pressed. Currently when the button is pressed, the video continues to play.
What code do i need and where do I put it, in the player layer, or the button layer? I hope this is clear.
thanks,
here is the code for the player layer:

var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
videoStream.play(" http://www.video.flv");
var metaListener:Object = new Object();
metaListener.onMetaData =onMetaData;
videoStream.client = metaListener;
var video:Video = new Video();
video.attachNetStream(videoStream);
addChild(video);
video.y = 70;
video.x = 440;

function onMetaData(data:Object):void
{
play_btn.addEventListener(MouseEvent.CLICK, playMovie);
stop_btn.addEventListener(MouseEvent.CLICK, stopMovie);
}

function playMovie(event:MouseEvent):void
{
videoStream.play(" http://www.video.flv");
}

function stopMovie(event:MouseEvent):void
{
videoStream.pause();
}

Here is the code from the button layer:
hor.addEventListener(MouseEvent.CLICK, goForward);
hor.buttonMode = true;

function goForward(event:MouseEvent):void {
gotoAndPlay(hor.currentFrame + 21);

}

This topic has been closed for replies.

2 replies

July 16, 2008
Annoyingly, sounds from flvplayback or loaded movie clips continue playing even when the flvplayback or movieclip is removed because there is still a reference to the sound. Try putting video.stop(); and SoundMixer.stopAll(); in your button click event function
Participating Frequently
July 16, 2008
See this cool mp3 xml player with visualization, playlist and skins. Fully customisable. Vector. http://flashden.net/item/mp3-xml-strongplayerstrong-with-visualization-and-skins-vectorised/11851