Okay guys I’m back with some problems once again. I am right now trying to create a flash newsboard, the feeds i’m getting from is from a rss feed from another website.
I’ve already downloaded a sample xml from their feed and tried creating my newsboard. I’ve read from the tutorial in kirupa about loading xml and stuffs and I’ve managed to come load my xml. What i want to do is to create textfields with the titles of the news inside the text field. I also want to make the textfields clickable so when the user clicks on the title, it will bring them to the page.
This is my code :
/* Step 1:To Load xml and tracing it */
//create a url loader call xmlLoader
var xmlLoader:URLLoader = new URLLoader();
//make a new xml variable call xmldata.
var xmlData:XML = new XML();
//add listener to xmlLoader, so after load is completed, perform function loadXML
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
//load the url from xmlLoader(url loader)
xmlLoader.load(new URLRequest("xml/asiaoneHealth.xml"));
//function LoadXML, it will use target(xml/sampleXML.xml),
//after which inserts the selected xml into xmlData variable.
//it will then trace the xml file into flash's output.
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
//trace(xmlData);
ParseNews(xmlData);
}
/* end of Step 1 */
function ParseNews(newsInput:XML):void {
trace("XML Output");
trace("------------------------");
var newsChildren:XMLList = newsInput.channel.item.children();
var count:int = 0;
for each (var titleInfo:XML in newsChildren) {
if (titleInfo.name() == "title")
{
trace(titleInfo);
}
}
}
I manage to trace the titles of the different news that is in the xml file. What i want to do now is to create text fields(probably 5) to load these data in. But knowing that there are more than 5 news articles i want to input a next page or previous page function. Most importantly I’m looking for a way to create textfields via as.
I tried stuffs like creating a function but because i want to duplicate them I had exactly no idea on how to do this. I’ve searched through a lot of other websites but I cant seem to find the correct keyword for this problem. Please help me in this. All help is appreciated !!!