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
}