# Space bar as pause. Using as2 and netsream

**URL:** https://forum.kirupa.com/t/space-bar-as-pause-using-as2-and-netsream/296072
**Category:** Uncategorized
**Created:** [September 9, 2009, 9:53am UTC](https://forum.kirupa.com/t/space-bar-as-pause-using-as2-and-netsream/296072 "2009-09-09T09:53:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Lukelol](https://avatars.discourse-cdn.com/v4/letter/l/5daacb/32.png) [@Lukelol](https://forum.kirupa.com/u/Lukelol)
#### Post date: [September 9, 2009, 9:53am UTC](https://forum.kirupa.com/t/space-bar-as-pause-using-as2-and-netsream/296072/1 "2009-09-09T09:53:10Z")

</div>

Hey guys. Checking if anybody can help me here.  
Looking to use the space bar as a pause button/function for my flv player.  
I’ve done it before using onEnterframe but I’m battling to get it to work with the netstream, any ideas/help?

Here are the two sets of code I worked on:

1. 

\*onEnterFrame = function()  
{  
check\_keys();  
}

function check\_keys()  
{  
if(!Key.isDown(Key.SPACE))  
{  
ns.pause();  
}  
}

1. 

stage.addEventListener(KeyboardEvent.KEY\_DOWN, keyDown)  
function keyDown() {  
if (!Key.isDown(key.SPACE)) {  
if (ns.pause(false)  
ns.pause(true)  
else  
ns.pause(false)  
}  
}

\*Cheers and thanks in advance for ANY help.
