Hi
I am trying to build a simple xml based mp3 player for a project. I have got as far as combo/list boxes populating.
The first time you click the a track to play it all is well.
However, when you click another track, the first stops, but then I get error message.
Here’s the relevant code:
var snd:Sound = new Sound();
snd.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false,0,true);
var channel:SoundChannel;
var soundPlaying:Boolean = false;
:
:
function playSong(e:Event):void{
if (soundPlaying==true){
channel.stop();
soundPlaying=false;
}
var songURL:String = baseURL+album_cmb.selectedItem.label+"/"+songs_list.selectedItem.label;
snd.load(new URLRequest (songURL));
channel = snd.play();
soundPlaying=true;
//trace ("soundPlaying="+soundPlaying);
}
I think something might be wrong with the way I am attempting to load in the second sound - but that analysis might be wrong of course!
This is the error:
Error: Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful.
at flash.media::Sound/_load()
at flash.media::Sound/load()
at MP3s002_fla::MainTimeline/playSong()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.controls::SelectableList/handleCellRendererClick()
Any help greatfully received
thanks
E