# Closing NetStream video problem

**URL:** https://forum.kirupa.com/t/closing-netstream-video-problem/254805
**Category:** flash
**Created:** [March 15, 2008, 6:06pm UTC](https://forum.kirupa.com/t/closing-netstream-video-problem/254805 "2008-03-15T18:06:33Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![munatika](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@munatika](https://forum.kirupa.com/u/munatika)
#### Post date: [March 15, 2008, 6:06pm UTC](https://forum.kirupa.com/t/closing-netstream-video-problem/254805/1 "2008-03-15T18:06:33Z")

</div>

Hi everyone,

Does anyone know how to close a netstream video?  
I set up this page where I open a new netstream to play video when the button is clicked. The video plays fine. But, when I navigate to another page, the video disappears, but I can still hear it.

What is the script to close the netstream? And where do I put this script? Video page or in the page where I have my navigation links and loader?

Here is my actionscript from the video page:

var myVideo:NetConnection=new NetConnection();  
myVideo.connect(null);  
var newStream:NetStream= new NetStream(myVideo);  
videoHolder.attachNetStream(newStream);  
this.play\_btn.addEventListener(MouseEvent.CLICK,resumefunction)  
this.play\_btn.visible=false  
function resumefunction (myevent:MouseEvent):void {  
newStream.resume()  
}  
this.stop\_btn.addEventListener(MouseEvent.CLICK,stopfunction)  
this.stop\_btn.visible=false  
function stopfunction (myevent:MouseEvent):void {  
newStream.pause()  
newStream.seek(0)  
}

this.beauty\_btn.addEventListener(MouseEvent.CLICK, playBeauty);  
function playBeauty (myevent:MouseEvent):void{  
newStream.play(“videos/beauty.flv”)  
this.play\_btn.visible=true  
this.stop\_btn.visible=true  
}

this.brief\_btn.addEventListener(MouseEvent.CLICK, playBrief);  
function playBrief (myevent:MouseEvent):void{  
newStream.play(“videos/brief.flv”)  
this.play\_btn.visible=true  
this.stop\_btn.visible=true  
}  
this.christos\_btn.addEventListener(MouseEvent.CLICK, playChristos);  
function playChristos (myevent:MouseEvent):void{  
newStream.play(“videos/christos.flv”)  
this.play\_btn.visible=true  
this.stop\_btn.visible=true  
}  
this.into\_btn.addEventListener(MouseEvent.CLICK, playComplex);  
function playComplex (myevent:MouseEvent):void{  
newStream.play(“videos/complex.flv”)  
this.play\_btn.visible=true  
this.stop\_btn.visible=true  
}

newStream.addEventListener(AsyncErrorEvent.ASYNC\_ERROR,errorhandler)  
function errorhandler (myevent:AsyncErrorEvent){//ignore error  
}
