0 Replies Latest reply on Jun 13, 2006 2:22 AM by byenary

    RSS 2.0 parser loop (issue with load unload)

    byenary
      Hello,
      Im using a GNU class from http://sunouchi.31tools.com/ASRssParser/#usage
      to parse rss2.0 files.
      In the example on the site it parses one file, but i need to parse more files and put them in an array.
      Im not an experienced AS writer, but i just put an loop around rssObj.load
      The onload function should be called when the fetching is done.
      The result now i only get the results from the last rss...
      Any solving Ideas.

      Cheers
      code :

      // import package
      import com.cybozuLab.rssParser.*;
      // create FetchingRss class instance
      // set the target RSS URL
      var xmlsource = new Array();
      xmlsource[0] = " http://www.nieuwsblad.be/Regio/WestVlaanderen/feed.xml";
      xmlsource[1] = " http://www.sportwereld.be/Tennis/feed.xml";
      xmlsource[2] = " http://rss.vrtnieuws.net/nieuwsnet_master/versie2/systeem/rss/nnII_nieuws_hoofdpunten/inde x.xml";

      for (i=0;i<2;i++){
      Trace(xmlsource );
      var rssObj = new FetchingRss(xmlsource
      ); // change exist URL
      var thisObj = this;
      rssObj.load();
      }
      // define the function when loading is completed
      rssObj.onLoad = function( successFL, errMsg )
      {
      if( successFL )
      {
      // call function for listing summary
      thisObj.listSummary();
      }
      else
      {
      trace( errMsg );
      }
      }

      // start loading
      function listSummary()
      {
      var rssData:Object = rssObj.getRssObject();
      for( var i=0; i<rssData.channel.item.length; i++ )
      {
      var post:Object = rssData.channel.item ;
      trace( post.title.value );
      trace( post.description.value.substr( 0, 60 ) + "\n" );
      }
      }