0

I'm trying to get my rss feed to load in my dynamix text box in Flash AS2. Although it just says 'undefined' My dynamic text box is call xml_holder. Any light on this would be much appreciated. Thank you.

I have this script attached to an empty keyframe above my dynamic text box layer.

stop();
xmlLoad = new XML();
xmlLoad.load("http://www.astrology.com/horoscopes/monthly-overview.rss");
xmlLoad.ignoreWhite = true;
xml_holder.html = true;
xmlLoad.onLoad = function(success){
   //if successful
   if(success && xmlLoad.status == 0){      
  //reset the text
  xml_text="";   
  //list of items
  var xmlItems:XML = xmlLoad.firstChild.firstChild;
  for (var m = 0; m<xmlItems.childNodes.length; m++) {
     //grab each item
     if (xmlItems.childNodes[m].nodeName == "item") {
        for (var n = 0; n<xmlItems.childNodes[m].childNodes.length; n++) {
           if (xmlItems.childNodes[m].childNodes[n].nodeName == "link") {
              //grab the link of the item
              itemlink=xmlItems.childNodes[m].childNodes[n].firstChild.toString();   
           }
           if (xmlItems.childNodes[m].childNodes[n].nodeName == "title") {
              //grab the title of the item
              itemtitle=xmlItems.childNodes[m].childNodes[n].firstChild.toString();   
           }
        }
        //add the current item
        xml_text+= "<a href=\""+itemlink+"\">"+itemtitle+"</a><br><br>";
     }   
  }         
  }
  //set the text
  xml_holder.htmlText = xml_text;
  }

1 Answers1

0

Your code is working for me, check that the font you use in the xml_holder texfield are embed.

You can also :

  • trace xml_text just before xml_holder.htmlText = xml_text; to check if it contains the generated HTML.
  • trace xml_holder to check that the textfield is defined at the moment it needs to be accessed.
RafH
  • 4,504
  • 2
  • 23
  • 23
  • Perfect! Although it only displays the titles, not the body text. How do you have it display the body text? Much appreciated. – MattsterMatt Oct 14 '13 at 02:55
  • On another note, it still says undefined once I upload the swf to the server. This only works locally when tested. Any light on this issue would help. Thank you. – MattsterMatt Oct 14 '13 at 03:40
  • No worries. I figured out the undefined error thing. I had to mirror the feed using Google Feedburner. Once I imported the RSS url into feedburner, and used that rss url. It worked. No undefined error. Thank you again RafH for your help. :) – MattsterMatt Oct 16 '13 at 02:13