# Stop video player

**URL:** <https://forum.kirupa.com/t/stop-video-player/249792>\
**Category:** Uncategorized\
**Created:** [January 22, 2008, 4:40pm UTC](https://forum.kirupa.com/t/stop-video-player/249792 "2008-01-22T16:40:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kagamushu](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@kagamushu](https://forum.kirupa.com/u/kagamushu)\
**Post date:** [January 22, 2008, 4:40pm UTC](https://forum.kirupa.com/t/stop-video-player/249792/1 "2008-01-22T16:40:00Z")

</div>

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](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](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);

}
