Jump to content


Problem loading xml into dynamic field


  • You cannot reply to this topic
2 replies to this topic

#1 Lady Ramses

    Young Padawan

  • Members
  • Pip
  • 5 posts

Posted 26 October 2006 - 09:43 PM

I can't seem to get the xml to load into a dynamic field.

here is my actionscript:

//
rssURL = "feed url here";
//
function loadRSSfeed() {
// set xml object
var thisrssfeed = new XML();
thisrssfeed.ignoreWhite = true;
thisrssfeed.contentType = "text/xml";
thisrssfeed.onLoad = function(success) {
if (success) {
processxml(thisrssfeed);
// do stuff
for (var j = 1; j<6; j++) {
trace(_root["RSSItem"+j].feedTitle);
trace(_root["RSSItem"+j].feedUrl);
if (_root["RSSItem"+j].feedDescription != undefined) {
trace(_root["RSSItem"+j].feedDescription);
}
trace(_root["RSSItem"+j].feedDate);
trace(_root["RSSItem"+j].feedGuid);
trace("----------");
}
} else {
// do error handling
}
};
thisrssfeed.load(rssURL+"&uniq="+new Date().getTime());
}
//
function processxml(thisxml) {
var thisxml = thisxml.firstChild.firstChild.childNodes;
// this first five attributes aren't required:
for (i=5; i<10; i++) {
node = thisxml[i];
_root["RSSItem"+(i-4)] = new Object();
_root["RSSItem"+(i-4)].feedTitle = node.childNodes[0].firstChild.nodeValue;
_root["RSSItem"+(i-4)].feedUrl = node.childNodes[1].firstChild.nodeValue;
_root["RSSItem"+(i-4)].feedDescription = node.childNodes[2].firstChild.nodeValue;
_root["RSSItem"+(i-4)].feedDate = node.childNodes[3].firstChild.nodeValue;
_root["RSSItem"+(i-4)].feedGuid = node.childNodes[4].firstChild.nodeValue;
}
}
//
loadRSSfeed();
stop();



I have used: _root["RSSItem3"].feedTitle in the Var field as well as the instance

why is it now pulling the data?

thanks in advance!

#2 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 29 October 2006 - 09:14 AM

remove the variable from the textfield and give it an instance name of : feedTitle, feedUrl and so on...

#3 Lady Ramses

    Young Padawan

  • Members
  • Pip
  • 5 posts

Posted 29 October 2006 - 01:05 PM

how would i tell it which title to pull? i have 5 titles


i tried just adding the feedTitle but it still shows up blank

i attached the file i am using.



thanks so much for replying!

Attached Files







1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users