ok well im trying to add background music to my game. im coding on the main timline in the .fla and i tried using this code for the sound
( the sound is a .mp3 in the library)
var music:Sound = new Sound(new URLRequest("bgMusic.mp3"));
var sc:SoundChannel;
var isPlaying:Boolean = false;
btnStopMusic.addEventListener(MouseEvent.CLICK, stopMusic);
function stopMusic(e:Event):void
{
sc.stop();
isPlaying = false;
}
btnPlayMusic.addEventListener(MouseEvent.CLICK, playMusic);
function playMusic(e:Event):void
{
if (!isPlaying)
{
sc = music.play();
isPlaying = true;
}
}
as you can see that music should start when you hit the btnPlayMusic button. but for some reason is does not. help?