public class Main extends Sprite { private var _sound:Sound; private var _channel:SoundChannel; private var _playList:Array; // the list of songs private var _index:int = 0; // the current song
public function Main() { _playList = ["song1.mp3", "song2.mp3", "song3.mp3"]; playNextSong( ); }
private function playNextSong( ):void { if(_index < _playList.length) { _sound = new Sound( ); _sound.load(new URLRequest(_playList[_index])); _channel = _sound.play( );