Hey guys,
I’m working on a project where I want to take two different RSS feed titles and mash the results up. I know how to get the feed titles, but I dont know how to combine the two to mash them up. Any ideas?
Heres my code, I am using Flash CS4 (idk if that helps or not)
package {
import flash.net.*;
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class mashup extends MovieClip {
public function mashup() {
var loader:URLLoader = new URLLoader();
var loader2:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
loader2.addEventListener(Event.COMPLETE, onLoaded2);
var myText1:String = " ";
var myText2:String = " ";
var stopper:int = 0;
var xml:XML;
// this function takes an x and a y value as well as a string and will then place this string as text field on x/y location on the stage
function TextDisplay (yy:Number, xx:Number, input:String) {
// Create a TextField object
var t:TextField = new TextField();
var format1:TextFormat = new TextFormat(); //using the flash.text.TextFormat class to format the text.
format1.font = "Helvetica";
format1.size=15;
format1.color = 0xFF0000;
t.setTextFormat(format1);
t.width = 550;
// Specify the text to display
t.text = input;
t.y = yy;
t.x= xx;
t.setTextFormat(format1);
// Add the TextField object to the display list
addChild(t);
}
// this downloads RSS
function onLoaded(e:Event):void
{
xml = new XML(e.target.data);
var itemlist:XMLList = xml.channel.item;
myText1 = itemlist.title.text()[Math.round(Math.random()*10)];
TextCatcher();
}
function onLoaded2(e:Event):void
{
xml = new XML(e.target.data);
var itemlist:XMLList = xml.channel.item;
myText2 = itemlist.title.text()[Math.round(Math.random()*10)];
TextCatcher();
}
function TextCatcher():void {
if(myText1 != " " && myText2!=" "){
//put all your awesome text processing here:
trace(myText1);
trace(myText2);
}
}
// this says which RSS to download.
loader.load(new URLRequest("http://feeds2.feedburner.com/GSG"));
loader2.load(new URLRequest("http://www.videohypershred.com/feed/"));
}
}
}