mercredi 27 mai 2015

Action Script Next Button replay

I have an ActionScript music player that is pulling songs from an xml file. I have a Play button and a Next Button. I have 4 songs, but when I press the next button until the last song is playing, the next time I press next it doesn't goe back to the first song.

Here is the next button code:

//Next Song Functions
function nextSong(e:Event):void {
        if (currentIndex < (songlist.length() +1)) {//Next Song(+1)
        } else {
        //New Request for Next Song
        var nextSongFunc:URLRequest=new URLRequest(songlist[currentIndex].file);
        var nextTitle:Sound=new Sound(nextSongFunc);
        MusicName.text=songlist[currentIndex].name;//Writing New Song's name;
        sc.addEventListener(Ev9ent.SOUND_COMPLETE, nextSong);

What should I change so when I press next and there is no next music, it goes to the first one?

Aucun commentaire:

Enregistrer un commentaire