8 Replies Latest reply on May 29, 2007 12:03 AM by Greg Dove

    Error With loading XML file.Help me

      Hi!

      I am trying to make an mp3 player for my web site but I am having a little problens and I hope you can help me out.
      It is a xml driven mp3player. I have a mp3player.as file and a songs.xml file. Inside my flash movie I only have #include "mp3player.as".

      Here is my mp3player.as code :

      [CODE]
      //Setup Sound Object
      var s :Sound = new Sound();
      s.onSoundComplete = playSong;
      s.setVolume(75);

      //Array of sounds
      var sa:Array = new Array();

      //Current Playing Song
      var cps : Number = -1;

      //Load the XML into a xml file
      var xml :XML = new XML();
      xml.ignoreWhite = true;
      xml.onLoad = function()
      {
      var nodes : Array = this.firstChild.childNodes;
      for(var i=0;i<nodes.length;i++)
      {
      sa.push(nodes .attributes.url);
      }
      playSong();
      }

      xml.load("mp3player.xml");


      // Play mp3 file
      function playSong() :Void
      {
      if(cps == sa.length -1)
      {
      cps = 0;
      s.loadSound(sa[cps],true);
      }
      else
      {
      s.loadSound(sa[++cps],true);
      }

      }
      [/CODE]

      And here is my songs.xml file :
      [CODE]
      <?xml version="1.0" encoding="UTF-8"?>
      <songs>
      <song url="music\setsite.mp3" />
      <song url="music\Soul Magic - Soul Magic.mp3" />
      <song url="music\Technotronic - NRG Flow.mp3" />
      </songs>
      [/CODE]

      Everytime I test my movie I have this msg :
      Error opening URL 'file:///C|/Documents%20and%20Settings/Administrator/My%20Documents/Web%20Sites/site%20MA IO%202007/undefined'

      What is wrong with my code?

      When I comment this line xml.load("songs.xml") my movie runs fine.But I cant fix it..

      thank you