# Sound stream won't play

**URL:** <https://forum.kirupa.com/t/sound-stream-wont-play/330488>\
**Category:** flash\
**Created:** [January 29, 2013, 12:34am UTC](https://forum.kirupa.com/t/sound-stream-wont-play/330488 "2013-01-29T00:34:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![straris](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@straris](https://forum.kirupa.com/u/straris)\
**Post date:** [January 29, 2013, 12:34am UTC](https://forum.kirupa.com/t/sound-stream-wont-play/330488/1 "2013-01-29T00:34:21Z")

</div>

[COLOR=#000000][FONT=Arial]i am creating an online radio but i am having a weird problem, the code works for 5 times! after that the play button won’t function![/FONT][/COLOR]  
[COLOR=#000000][FONT=Arial]I am not sure if this is relevant but i am also getting _SecurityError: Error #2000: No active security context._ when i close the swf player.[/FONT][/COLOR]

[COLOR=#00008B]import[/COLOR] flash.events.[COLOR=#2B91AF]MouseEvent[/COLOR];  
[COLOR=#00008B]var[/COLOR] streaming:[COLOR=#2B91AF]Boolean[/COLOR];  
[COLOR=#00008B]this[/COLOR].addEventListener([COLOR=#2B91AF]MouseEvent[/COLOR].CLICK, music\_on)  
[COLOR=#00008B]  
function[/COLOR] music\_on([COLOR=#00008B]event[/COLOR]:[COLOR=#2B91AF]MouseEvent[/COLOR]):[COLOR=#00008B]void[/COLOR]{  
[COLOR=#00008B]var[/COLOR] sndChannel:[COLOR=#2B91AF]SoundChannel[/COLOR]=[COLOR=#00008B]new[/COLOR] [COLOR=#2B91AF]SoundChannel/COLOR;  
[COLOR=#00008B]var[/COLOR] s:[COLOR=#2B91AF]Sound[/COLOR] = [COLOR=#00008B]new[/COLOR] [COLOR=#2B91AF]Sound/COLOR;

```
[COLOR=#00008B]if[/COLOR] (!streaming) { 

```

gotoAndStop([COLOR=#800000]2[/COLOR]);  
[COLOR=#00008B]var[/COLOR] req:[COLOR=#2B91AF]URLRequest[/COLOR] = [COLOR=#00008B]new[/COLOR] [COLOR=#2B91AF]URLRequest/COLOR;  
[COLOR=#00008B]var[/COLOR] context:[COLOR=#2B91AF]SoundLoaderContext[/COLOR] = [COLOR=#00008B]new[/COLOR] [COLOR=#2B91AF]SoundLoaderContext/COLOR;  
s.load(req, context); sndChannel=s.play();  
streaming=[COLOR=#00008B]true[/COLOR];  
}

```
[COLOR=#00008B]else[/COLOR] { 
   gotoAndStop([COLOR=#800000]1[/COLOR]);
    streaming=[COLOR=#00008B]false[/COLOR]; 
   sndChannel.stop();
    [COLOR=#2B91AF]SoundMixer[/COLOR].stopAll();
    trace ([COLOR=#800000]"not playing"[/COLOR]); 

```

}  
}stop();
