# Closeing a net connection and stream

**URL:** <https://forum.kirupa.com/t/closeing-a-net-connection-and-stream/265945>\
**Category:** flash\
**Created:** [July 14, 2008, 9:02pm UTC](https://forum.kirupa.com/t/closeing-a-net-connection-and-stream/265945 "2008-07-14T21:02:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chriswilson](https://avatars.discourse-cdn.com/v4/letter/c/b9e5f3/32.png) [@chriswilson](https://forum.kirupa.com/u/chriswilson)\
**Post date:** [July 14, 2008, 9:02pm UTC](https://forum.kirupa.com/t/closeing-a-net-connection-and-stream/265945/1 "2008-07-14T21:02:42Z")

</div>

var nc:NetConnection = new NetConnection();  
nc.connect(null);  
var ns:NetStream = new NetStream(nc);  
trailer.attachVideo(ns);  
ns.play(“trailer.flv”);

Is this the right code to have the video playback component stop playing when someone click to a different part of the site while the video is playing?

thanks

---

<div class="post-metadata">

**Author:** ![dail](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@dail](https://forum.kirupa.com/u/dail)\
**Post date:** [July 15, 2008, 1:57am UTC](https://forum.kirupa.com/t/closeing-a-net-connection-and-stream/265945/2 "2008-07-15T01:57:57Z")

</div>

Just close the netStream  
ns.close();

---

<div class="post-metadata">

**Author:** ![chriswilson](https://avatars.discourse-cdn.com/v4/letter/c/b9e5f3/32.png) [@chriswilson](https://forum.kirupa.com/u/chriswilson)\
**Post date:** [July 15, 2008, 8:39pm UTC](https://forum.kirupa.com/t/closeing-a-net-connection-and-stream/265945/3 "2008-07-15T20:39:18Z")

</div>

I’m not to sure how to put the ns.close(); into the component…right now I don’t have any actionscripting for the component. what would the actionscripting look like for the component?

[quote=dail;2358708]Just close the netStream  
ns.close();[/quote]
