3 Replies Latest reply on Jul 6, 2007 5:49 AM by Marghoob Suleman

    XML newbie question - xml into arrays

    Level 7
      I am pretty new xml and I am working with a file that has text
      associated with images in the file and I would like to move the text
      into a xml document.

      I heard that a good way to deal with xml is to load it into an array. I
      have my text set up in arrays already, so my whole file aready works in
      that way. So all I have to do is load my xml document into my arrays. I
      have the xml document loading fine, but I don't know how to get the info
      into my arrays.

      My xml document looks like this:


      <?xml version="1.0" encoding="utf-8" standalone="yes"?>

      <index_content>

      <image no="1">
      <imgLink>"pages/collection.html"</imgLink>
      <title>"Title 01"</title>
      <text>"Text bla bla, bla 01, Text bla bla, bla 01"</text>
      <corner>"unisex"</corner>
      </image>

      <image no="2">
      <imgLink>"pages/collection.html"</imgLink>
      <title>"Title 02"</title>
      <text>"Text bla bla, bla 02, Text bla bla, bla 02"</text>
      <corner>"men’s & women’s"</corner>
      </image>

      <image no="3">
      <imgLink>"pages/collection.html"</imgLink>
      <title>"Title 03"</title>
      <text>"Text bla bla, bla 03, Text bla bla, bla 03"</text>
      <corner>"men’s & women’s"</corner>
      </image>

      <image no="4">
      <imgLink>"pages/collection.html"</imgLink>
      <title>"Title 04"</title>
      <text>"Text bla bla, bla 04, Text bla bla, bla 04"</text>
      <corner>"men’s & women’s"</corner>
      </image>

      </index_content>





      My arrays in Flash are:
      var imgLinkURLs:Array = [];
      var imgTitles:Array = [];
      var imgTexts:Array = [];
      var imgCornerLabel:Array = [];


      So I think i need for loops pushing for example imgLink from image no1
      into imgLinkURLs array, then push imgLink from image no2, and so forth.
      Then do the same for imgTitle and the other arrays...

      How would I do this the right way?