Mi problema está en el medio... no entiendo cómo funciona eso de crear un xml desde un php, y llamarlo desde Flash... o sea, tengo mi_archivo_xml.php y en flash tengo un myXML.load("archivo.xml");
tengo el AS:
Código ActionScript :
var myXML:XML = new XML();
myXML.ignoreWhite=true;
myXML.load("archivo.xml");
myXML.onLoad = function(success)
{
if (success)
{
var myImage = myXML.firstChild.childNodes;
for (i=0; i<myImage.length; i++)
{
var myImage2 = myXML.firstChild.childNodes[i].childNodes;
dia = myImage2[0].firstChild.nodeValue;
hora = myImage2[1].firstChild.nodeValue;
lugar = myImage2[2].firstChild.nodeValue;
zona = myImage2[3].firstChild.nodeValue;
mitexto.html = true;
mitexto.htmlText += dia + " " + hora + " " + " <b>" + lugar + "</b>" + " //" + zona;
mitexto.htmlText += "\n";
}
}
}; funciona perfecto con un XML puro... y viendo algunos tips y tutos de cristalab el PHP que genera el XML:
Código PHP :
header("Content-type: text/xml");
echo '<?xml version="1.0" encoding="utf-8"?>';
include ("includes/config.php");
include ("includes/funciones.php");
$cnx = conectar();
$sql = "SELECT * FROM calendar ORDER BY id ASC";
$res = mysql_query($sql) or die("output=error&msg=".mysql_error());
if(mysql_num_rows($res) > 0)
{
echo "<calendar>";
$contador = 0;
//parseamos la información guardándola en $salida.
while($fila = mysql_fetch_array($res))
{
$salida.= "<fecha>";
$salida.= "<dia>" . fila['fecha'] . "</dia>";
$salida.= "<correo>" . fila['hora'] . "</correo>";
$salida.= "<cuerpo>" . fila['lugar'] . "</cuerpo>";
$salida.= "<remitente>" . fila['zona'] . "</remitente>";
$salida.= "</fecha>";
$contador++;
}
//agregamos el total de registros a la salida.
$salida.="total=$contador&";
//imprimimos la salida.
echo $salida;
echo "</calendar>";
//liberamos memoria
mysql_free_result($res);
//cerramos la conexión
mysql_close($cnx);
//detenemos la ejecucion de la pagina.
exit;
}no entiendo cómo funciona... una ayudita?
mil gracias...
Salut! Emiliano
