dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: reading an XML file for a playlist

  1. #1
    Member
    Join Date
    Aug 2001
    Posts
    98

    reading an XML file for a playlist

    Here is my XML file:

    Code:
    src="Alice%20in%20Chains%20-%20Rotten%20Apple.swf" desc="Rotten Apple" artist="Alice in Chains" album="Jar of Flies" minutes="6" seconds="59"
    src="Modest%20Mouse%20-%20The%20Waydown.swf" desc="The Waydown" artist="Modest Mouse" album="The Fruit That Ate Itself" minutes="2" seconds="30"
    I have an audio player which works and plays the songs, I can go to the next track. But is there a way to read this XML file, get the song and title to list a playlist? I'd assume I'd need a for or while loop. I'm keeping the XML code like this, because it works so far. I took out the tags, because it wasn't displaying right.
    Fly pelican, fly! ~ Tony Montana

  2. #2
    Novemberain Master
    Join Date
    Sep 2004
    Location
    Void
    Posts
    390
    var fNode = this.firstChild;
    var playlist = new Array();
    for(var i=0; i<fNode.childNodes.length; i++){
    playlist[i] = new Object();
    playlist[i]["songName"] = fNode.childNodes[i].attributes.desc;
    playlist[i]["artist"] = fNode.childNodes[i].attributes.artist;
    // And so on...
    }


    In the long run you will have an array of objects each of them is a playlist item.

    Sorry that I posted this code without formatting but there seems to be a problem to display square braces with i iterator within the code tag. Board recornizes it as italic tag.
    Last edited by Unsteady; 03-17-2005 at 08:23 AM.


    Never give up...

  3. #3
    Member
    Join Date
    Aug 2001
    Posts
    98
    I'll try this when I get home, would you put the list into a textbox, or mc,for scrolling purposes? I'd also like them to be able click the song the want to play.
    Fly pelican, fly! ~ Tony Montana

  4. #4
    Novemberain Master
    Join Date
    Sep 2004
    Location
    Void
    Posts
    390
    I'll post an example for you when I'll get time.


    Never give up...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center