Tema: xml y flash?
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 31/08/2004, 10:29
Avatar de Teufel
Teufel
 
Fecha de Ingreso: agosto-2001
Ubicación: Guatechula
Mensajes: 41
Antigüedad: 22 años, 9 meses
Puntos: 0
Cita:
Iniciado por alainmacias
Hola, esto es puro código pero quizás te sirva para ver como cargar el XML y navegar por los diferentes nodos... Tengo el archivo Flash, si quieres te lo envío.

function processXMLData(success)
{
if (success)
{
var rootNode=this.firstChild;

var headerNode=findNode(rootNode, "header");
header=getValue(headerNode);

var contentNode=findNode(rootNode, "content");
content=getValue(contentNode);

var authorNode=findNode(rootNode, "author");
author=getValue(authorNode);


/*
var newsNode=this.firstChild;
var headerNode=newsNode.childNodes[0];
var contentNode=newsNode.childNodes[1];
var infoNode=newsNode.childNodes[2];
var authorNode=infoNode.childNodes[1];

header=headerNode.firstChild.nodeValue;
content=contentNode.firstChild.nodeValue;
author=authorNode.firstChild.nodeValue;
*/
}
else
{
content="Today's news is not found";
}
}

function getValue(node)
{
if (node && node.firstChild)
return node.firstChild.nodeValue;
return "";
}

function findNode(node, nodeName)
{
if (node.nodeName==nodeName)
return node;
for (var i=0; node.childNodes && i<node.childNodes.length; i++)
{
var foundNode=findNode(node.childNodes[i], nodeName);
if (foundNode!=null)
return foundNode;
}
return null;
}

var xmlData=new XML();
xmlData.ignoreWhite=true;
xmlData.onLoad=processXMLData;
xmlData.load("news.xml");
stop();

Saludos,

www.insade.cl
Te agradeceria mucho ke me enviaras el fla, me lo puedes enviar x mail a [email protected]. Gracias! ;)
__________________
Visita Toienlinea.com mi blog personal :arriba: