1 Reply Latest reply on Oct 10, 2006 2:18 PM by Peter Lorent

    Arrays stored in class

    thewhitewood
      Hi guys,

      currently workng on my own private class to access and store an xml doc.

      my current class looks like:

      // ---------------------------

      class Blogger {

      public var feedURL:String;
      private var totalEntries:Number;
      public var blogEntries:Array = [];

      public function Blogger(feedSource:String) {

      feedURL = feedSource;
      var data_xml= new XML();
      data_xml.ignoreWhite = true;
      var blogEntries:Array = [];

      data_xml.onLoad = function(success) {
      if (success) {
      totalEntries = data_xml.firstChild.childNodes.length - 10;
      for (var i:Number = 0; i < totalEntries; i++){
      blogEntries.push({ author:data_xml.childNodes[0].childNodes[(10+i)].childNodes[1].childNodes[0].childNodes[0 ].nodeValue,
      date:data_xml.childNodes[0].childNodes[(10+i)].childNodes[4].childNodes[0].nodeValue,
      title:data_xml.childNodes[0].childNodes[(10+i)].childNodes[7].childNodes[0].nodeValue,
      article:data_xml.childNodes[0].childNodes[(10+i)].childNodes[8].childNodes[0].nodeValue
      });
      }
      }
      }

      data_xml.load(feedURL);
      }
      }

      // -----------

      Now all the xml is loading and being accessed fine, the problem I am having is pushing this data into the array I have created to store it all "BlogEntries". This is continuously coming back as length of 0 so the data is for some reason not being pushed in.. any ideas or help gratefully received.

      cheers everyone!
      nick