1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| // Init Player
var stream1:Sound = new Sound(); // Init Player 1
var serverStream:URLRequest=new URLRequest("http://stream.radioneo.org:8000/;");
var context:SoundLoaderContext = new SoundLoaderContext(3000, true); // Init BufferSize
var channel:SoundChannel;
// Load Player1 (stream + buffer)
stream1.load(serverStream,context);
channel = stream1.play(); // Play Player 1
this.BT_Play_Off.visible = false; // Cache le bouton On
// Create Fonction Player OnOff
this.BT_Play_Off.addEventListener(MouseEvent.CLICK,playON);
this.BT_Play_On.addEventListener(MouseEvent.CLICK,playOFF);
// Fonction
function playON(e:MouseEvent):void
{
trace("Play On");
this.BT_Play_On.visible = true;
this.BT_Play_Off.visible = false;
channel = stream1.play();
}
function playOFF(e:MouseEvent):void
{
trace("Play Off");
this.BT_Play_On.visible = false;
this.BT_Play_Off.visible = true;
channel.stop();
} |
Partager