[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();