# Communicating between frames

**URL:** <https://forum.kirupa.com/t/communicating-between-frames/231620>\
**Category:** flash\
**Created:** [July 6, 2007, 8:00am UTC](https://forum.kirupa.com/t/communicating-between-frames/231620 "2007-07-06T08:00:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Louis777](https://avatars.discourse-cdn.com/v4/letter/l/bc8723/32.png) [@Louis777](https://forum.kirupa.com/u/Louis777)\
**Post date:** [July 6, 2007, 8:00am UTC](https://forum.kirupa.com/t/communicating-between-frames/231620/1 "2007-07-06T08:00:23Z")

</div>

Hello, I am using AS3 & Flash CS3. I have 6 frames. In the first frame I initialize my netconnection and netstream along with a button (bttn\_rec) to start recording. When the record button is clicked it starts recording and it calls gotoAndStop(10) to go to the second frame which has the following code:

bttn\_stop.addEventListener(MouseEvent.CLICK, onClick\_stop);  
function onClick\_stop(event:MouseEvent):void  
{  
ns.pause();  
ns.seek(0);  
ns.close();  
gotoAndStop(20);  
}

At this point the bttn\_stop button is enabled but when clicked, to execute this code, the netstream (ns) is no longer recognized or defined.

What can I do to execute this code from the first frame when my bttn\_stop button is clicked? or is there a better way to do this?

Thanks in advance,

Louis
