If sound is external:
// if music file is in another url (not in the same folder as the *.swf file) use "http://yoursite.com/music.mp3" instead.PHP Code:var music:Sound = new Sound()
music.load(new URLRequest("music.mp3"));
music.play(0, int.MAX_VALUE);
If sound is in library, with class name "music":
And i have a method to loop forever... you play it MAX_VALUE times, and add a listener to listen for the music to finishes, then play it it again MAX_VALUE times.PHP Code:var music1:music = new music();
music1.play(0, int.MAX_VALUE);
I have not waited for hours to see if it really loops, but I've waited quite long and it keeps playing...PHP Code:var music1:music = new music();
var chan:SoundChannel = new SoundChannel();
chan = music1.play(0, int.MAX_VALUE);
chan.addEventListener(Event.SOUND_COMPLETE, loop);
function loop(e:Event):void
{
chan = music1.play(0, int.MAX_VALUE);
}




Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries 
Reply With Quote