4 Replies Latest reply on May 16, 2006 6:22 AM by nardove

    Actionscript for this xml

    Level 7
      Hello,

      Please could you give me the actionscript for read this xml
      thank you very very much for your help

      <? xml version="1.0" encoding="UTF-8" ?>
      <diaporama>
      <photo>
      <titre_diaporama>Title diaporama</titre_diaporama>
      </photo>
      <photo>
      <nom>images/1.jpg</nom>
      <titre>Title for picture 1</titre>
      </photo>
      <photo>
      <nom>images/2.jpg</nom>
      <titre>Title for picture 2</titre>
      </photo>
      <photo>
      <nom>images/3.jpg</nom>
      <titre>Title for picture 3</titre>
      </photo>
      </diaporama>


        • 1. Re: Actionscript for this xml
          nardove Level 1
          var arreglo = new Array();

          var file_xml = new XML();
          file_xml.ignoreWhite = true;
          file_xml.onLoad = function(sucess) {
          if (sucess) {
          processCase(file_xml);
          }
          };
          file_xml.load("yourfile.xml");
          function processCase(xmlDoc_xml) {
          for (n in xmlDoc_xml.firstChild.childNodes) {
          arreglo[n] = new Array();
          arreglo[n][0] = xmlDoc_xml.firstChild.attributes.thumbpath+xmlDoc_xml.firstChild.childNodes[n].childNodes [0].firstChild.nodeValue;
          arreglo[n][1] = xmlDoc_xml.firstChild.childNodes[n].childNodes[1].firstChild.nodeValue;
          }
          }

          trace the arreglo to see the results and find out how can you manipulate to use the data

          hope that helps

          rS
          • 2. Re: Actionscript for this xml
            nardove Level 1
            i forgot more information in

            http://actionscript.org/tutorials/intermediate/XML/index.shtml

            i learn from that site

            rS
            • 3. Re: Actionscript for this xml
              Level 7
              hello,

              i have an undefined i dont know why ;(
              please could you help me for have the name of my picture and the title of my
              picture
              and the title of my "titre_diaporama"
              thank you for your help

              "nardove" <webforumsuser@macromedia.com> a �crit dans le message de news:
              e4cg0o$eka$1@forums.macromedia.com...
              > var arreglo = new Array();
              >
              > var file_xml = new XML();
              > file_xml.ignoreWhite = true;
              > file_xml.onLoad = function(sucess) {
              > if (sucess) {
              > processCase(file_xml);
              > }
              > };
              > file_xml.load("yourfile.xml");
              > function processCase(xmlDoc_xml) {
              > for (n in xmlDoc_xml.firstChild.childNodes) {
              > arreglo[n] = new Array();
              > arreglo[n][0] =
              > xmlDoc_xml.firstChild.attributes.thumbpath+xmlDoc_xml.firstChild.childNodes[n].c
              > hildNodes[0].firstChild.nodeValue;
              > arreglo[n][1] =
              > xmlDoc_xml.firstChild.childNodes[n].childNodes[1].firstChild.nodeValue;
              > }
              > }
              >
              > trace the arreglo to see the results and find out how can you manipulate
              > to
              > use the data
              >
              > hope that helps
              >
              > rS
              >


              • 4. Re: Actionscript for this xml
                nardove Level 1
                of course i'll help but i need to know have are you trying to do

                try this

                trace(arreglo[0][0]+" - "+arreglo[0][1]);

                that shoud trace the first item on your xml file

                rS