Jump to content

Abrir XML de um RSS feed no flash


realizemidia

Recommended Posts

realizemidia

ola galera sou novo aqui no forum e preciso de ajuda para criar um painel de noticias em flash

vamos la

tenho que criar um swf que abra dinamicamente noticias via rss feed com image, titulo, e descrição

segue um modelo do que preciso seria identico a esse

http://www.behance.net/gallery/Templates-Terra-DOOH/4972185

com noticias veriadas facil de trocar

aguardo ajuda da galera

obrigado

Link to post
Share on other sites
realizemidia

ai galera consegui esse codigo que esta mostrando a noticias

so que nao mostra imagem nenhum e as palavras estão sem acentos

conto com a ajuda do pessoal para resolver meu problema

codigo As2

System.useCodepage = true;

//crio campo de texto pra receber xml
var campoTxt:TextField = this.createTextField("campoTxt", _root.getNextHighestDepth(), 0, 0, 20, 20);
campoTxt.autoSize = true;
campoTxt.multiline = true;
campoTxt.html = true;

var arquivo:XML = new XML();
arquivo.load("http://www.terra.com.br/rss/Controller?channelid=20e07ef2795b2310VgnVCM3000009af154d0RCRD&ctName=atomo-galeria&lg=pt-br");
arquivo.ignoreWhite = true;
arquivo.onload = leiaXml;

function leiaXml(ok:Boolean):Void
{
if(ok)
{
	//string que recebe conteudo do xml
	var title:String = String(arquivo.firstChild.firstChild.childNodes[10].childNodes[0].childNodes);
	var content:String = String(arquivo.firstChild.firstChild.childNodes[10].childNodes[1].childNodes);
var link:String = String(arquivo.firstChild.firstChild.childNodes[10].childNodes[2].childNodes);
	var description:String = String(arquivo.firstChild.firstChild.childNodes[10].childNodes[3].childNodes);
	var pubDate:String = String(arquivo.firstChild.firstChild.childNodes[10].childNodes[4].childNodes);
	var guid:String = String(arquivo.firstChild.firstChild.childNodes[10].childNodes[5].childNodes);



	//aplico conteudo no campo de texto
	campoTxt.htmlText = title;
	campoTxt.htmlText += content;
campoTxt.htmlText += "<font color='#ff0000'><a href='"+ link +"' target='_blank'><u><b>"+link +"</b></u></a></font>";;
	campoTxt.htmlText += description;
	campoTxt.htmlText += pubDate;
	campoTxt.htmlText += guid;


}
else{ trace("nao leu xml");}
}
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.