I am doing Android app using Flash CS6 and Adobe AIR. It is a simple streaming radio player with one button for play and stop. I would like to add a new button with a timer function (sleep) that stops the player or exit the app) after 30 minutes. How could I add this?
Here is the code I am using (works fine):
button_1.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound);
var fl_SC:SoundChannel;
var fl_ToPlay:Boolean = true;
function fl_ClickToPlayStopSound(evt:MouseEvent):void
{
if(fl_ToPlay)
{
var s = new Sound(new URLRequest("http://myradio.com/stream.mp3"));
fl_SC = s.play();
}
else
{
fl_SC.stop();
}
fl_ToPlay = !fl_ToPlay;
}