代码之家  ›  专栏  ›  技术社区  ›  trh88

从XML播放列表播放Flash MP3播放器循环

  •  0
  • trh88  · 技术社区  · 14 年前

    我有一个基于学校的mp3播放器的Flash代码。当我单击“下一首歌”时,我需要它转到下一首歌,除非它是播放列表中的最后一首歌,在这种情况下,它需要回到播放列表中的第1首歌。

    下面的代码似乎没有做的把戏,有什么想法,我去哪里错了?

    var songlist:XMLList;
    var currentIndex:Number = 0;
    

    还有。。

    function nextSong(e:Event):void
    {
     if (currentIndex < (songlist.length() - 1))
     {
      currentIndex++;
     }
     else
     {
      currentIndex = 0;
     }
    
     var nextReq:URLRequest = new URLRequest(songlist[1].url);
     var nextTitle:Sound = new Sound(nextReq);
     sc.stop();
     title_txt.text = songlist[1].title;
     artist_txt.text = songlist[1].artist;
     sc = nextTitle.play();
     songPlaying = true;
     currentSound = nextTitle;
    }
    
    1 回复  |  直到 14 年前
        1
  •  2
  •   Claus Wahlers    14 年前

    不应该吗 songlist[currentIndex] 而不是 songlist[1]