delayed trace

Commenta 14th November , 2009
ive got a loaded xml list for an mp3 player. from playing track1, when i select track 2, it traces "track1" but then after a second click it traces "track2" and stays on that. the actually music for track2 does load on the first click though, but not the trace.

anyone know why on the first click it would still trace the previous track?

here is the code for that function…

ActionScript Code:
/*When you choose a new item on the List it will play for you.*/         private function SnglClick(event:ListEvent):void {             var item:Object = event.item;                         try             {song.close();}             catch(error)             {}             try             {channel.stop();}             catch(error)             {}                         song = new Sound();             song.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);             song.load(new URLRequest(item.data));             pics.visible = true;                 switch (playList.selectedIndex){                     case 0:                     trace ("1 selected");                         MovieClip(pics).gotoAndStop(1);                     break;                                         case 1:                     trace ("2 selected");                         MovieClip(pics).gotoAndStop(2);                     break;                                         case 2:                     trace ("3 selected");                         MovieClip(pics).gotoAndStop(2);                     break;                                         default:                     trace ("default")                 }     //      if (playList.selectedIndex == 0){ //          trace ("1 selected"); //        } //        if (playList.selectedIndex == 1){ //          MovieClip(pics).gotoAndStop(2); //          trace ("2 selected"); //        } //        if (playList.selectedIndex == 2){ //          trace ("3 selected"); //        }             channel = song.play();             channel.soundTransform = (mute_mc.isMute)? new SoundTransform(0) : sndTrans;             channel.addEventListener(Event.SOUND_COMPLETE, soundComplete, false, 0, true);             position = 0;             playPause_mc.playing = true;             playPause_mc.gotoAndStop('pause');         }

thanks if anyone can help.

Original post by miles_holt

Lascia un Commento