Hi
I am trying to develop a custom AS3 RSS reader. I have got to a point where I have traced the pubDate, description & title from each item of the feed. My issue is how do I then get this info to display in seperate MCs on the stage? I can only display the last post in one MC rather all posts.
Here is my AS…
var container_mc:MovieClip;
var myTotal:Number;
var myItem:XMLList;
Font.registerFont(hattoriHanzo);
var textBox:TextField = new TextField();
var textBox1:TextField = new TextField();
var textBox2:TextField = new TextField();
var format:TextFormat = new TextFormat();
format.size = 24;
format.leading = 1;
format.align = TextFormatAlign.LEFT;
format.font = "Hattori Hanzo Light";
format.bold = true;
format.color = 0x004964;
format.letterSpacing = 2;
textBox = new TextField();
textBox.defaultTextFormat = format;
textBox.selectable = false;
textBox.mouseEnabled = false;
textBox.antiAliasType = AntiAliasType.ADVANCED;
textBox.multiline = true;
textBox.wordWrap = true;
textBox.width = 400;
textBox1 = new TextField();
textBox1.defaultTextFormat = format;
textBox1.selectable = false;
textBox1.mouseEnabled = false;
textBox1.antiAliasType = AntiAliasType.ADVANCED;
textBox1.multiline = true;
textBox1.wordWrap = true;
textBox1.width = 400;
textBox2 = new TextField();
textBox2.defaultTextFormat = format;
textBox2.selectable = false;
textBox2.mouseEnabled = false;
textBox2.antiAliasType = AntiAliasType.ADVANCED;
textBox2.multiline = true;
textBox2.wordWrap = true;
textBox2.width = 400;
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("http://www.onesg.co.uk/news/feed/"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
{
var myXML:XML = new XML(e.target.data);
myTotal = myXML.channel.item.length();
myItem = myXML.channel.item;
callNews();
container();
}
function callNews():void
{
for (var i:int = 0; i < myTotal; i++)
{
var myTitle = myItem*.title;
var myDate = myItem*.pubDate;
var myDesc = myItem*.description;
trace(myTitle);
trace(myDate);
trace(myDesc);
textBox.text = myTitle;
textBox1.text = myDate;
textBox2.text = myDesc;
}
}
function container():void
{
var container_mc = new MovieClip;
container_mc.addChild(textBox);
container_mc.addChild(textBox1);
container_mc.addChild(textBox2);
addChild(container_mc);
}
I hope my explanation makes sense.
Thanks
J_Mo