Hey everybody… i’m stuck again… maybe you guys can help and tell me what the problem is:
i have this PHP file that creates a perfect XML from MySql… at least i can see it on my browser.
The problem comes when i try to load that info into flash… it says something like undefined on the dynamic text field.
this is my PHP file:
<?
$link = mysql_connect ("localhost", "admin", "admin");
mysql_select_db("comdo_noticias");
$query = 'SELECT * FROM deportes ORDER BY Id DESC LIMIT 1';
$results = mysql_query($query);
echo "<?xml version=\"1.0\"?>
";
echo "<deportes>
";
while($line = mysql_fetch_assoc($results)) {
echo "<noticia>
";
echo "<fecha>" . $line["fecha"] . "</fecha>
";
echo "<titulo>" . $line["titulo"] . "</titulo>
";
echo "<firma>" . $line["firma"] . "</firma>
";
echo "<mensaje>" . $line["copy"] . "</mensaje>
";
echo "<imagen>" . $line["imagen"] . "</imagen>
";
echo "</noticia>
";
}
echo "</deportes>
";
mysql_close($link)
?>
and this is my actionscript on CS3
System.useCodepage = true;
var indice:Number;
var deportes_xml:XML;
function cargarDatos(_indice:Number) {
var fecha:String;
var titulo:String;
var firma:String;
var mensaje:String;
fecha = deportes_xml.firstChild.childNodes[_indice].attributes.fecha;
titulo = deportes_xml.firstChild.childNodes[_indice].firstChild.firstChild.nodeValue;
firma = deportes_xml.firstChild.childNodes[_indice].firstChild.nextSibling.firstChild.nodeValue;
mensaje = deportes_xml.firstChild.childNodes[_indice].lastChild.firstChild.nodeValue;
_root.deportes_txt.htmlText = "";
_root.deportes_txt.htmlText += "<p align='left'><font color='#ffffff' size='10'><b>"+titulo+"</b></font></p>";
_root.deportes_txt.htmlText += "<p><font size='8'>"+mensaje+"</font>";
_root.deportes_txt.htmlText += "<font color='#ffffff' size='10'>Publicado: "+fecha+"</font></p>";
}
indice = 0;
deportes_xml = new XML();
deportes_xml.ignoreWhite = true;
deportes_xml.load("prueba/php_deportes.php");
deportes_xml.onLoad = function() {
cargarDatos(indice);
};