PDA

View Full Version : XML news reader with XMLSA questions???


jasun
11-13-2006, 03:50 PM
Hey,

My question is either really simple or really complicated. My knowledge of actionscripts is very limited and I am trying to learn as much as possible thanks to great tutorials. I searched all the boards and could not find an answer to my question so here it goes. Please Help:confused:

I found the tutorial for a news ticker at http://www.flashmagazine.com/967.htm and I got my ticker to do exacatly what I want to. It uses XMLSA created by Max Ziebell. The ticker has an invisible button that has the action attached to it.
on(release){
getURL(rssURL,"_blank");
}
What I would like to do is add 2 additional news topics so that a total of 3 are showing and all of them link to there various locations. Any help would be appreciated, at this point I am tapped out of resources so if any one out there is vaguely familar please help.

Here is the as.
#include "XMLSA.as"

// Setup text fields

body.autoSize = "right";

head.autoSize = "right";

body.text = "Loading news stories";

// URL if the user clicks before data is loaded

rssURL = "http://www.flashmagazine.com";

// Load the XML/RSS

news = new XMLSA();

// Load the RSS file

news.load("http://www.flashmagazine.com/syndicated/flashmag.rss");

news.onLoad = function(success){

if (success) {

// Check RSS version and make shorthand

if(news.channel[0].item){

// Where to find data items for RSS 1.0

newsNode = news.channel[0];

} else {

// Where to find data items for RSS 0.91 and 2.0

newsNode = news;

}

// Store the number of news items

rssCount = newsNode.item.length;

// Call the showNext function every 5 seconds

setInterval(showNext,5000);

} else {

// Show error message

body.text = "Error loading XML";

}

}

// Function for getting next entry

showNext = function(){

// Zero the counter if the last article has been shown

if(rssCounter == rssCount || rssCounter == undefined){ rssCounter = 0; }

// Get values from XMLSA array

head.text = newsNode.item[rssCounter].title.getValue();

body.htmlText = newsNode.item[rssCounter].description.getValue();

rssURL = newsNode.item[rssCounter].link.getValue();

// Position the body text below the heading

body._y = head._y head._height;

// Increment the counter

rssCounter ;

}

If someone could point me in the right direction, any help would be greatly appreciated.

THanks

JE

Everything you can imagine is real.
-Pablo Picasso