Ok... para devolver cosas desde php a flash puedes usar dos tipos de elementos.
Variables directas: Que son algo asi como &variable=valor&;
o XML: Que tu construyes el xml y lo lees a traves de flash.
Me parece que lo recomendable es usar la segunda opcion para los valores encontrados y la primera para cuando hay errores.
Por ahora te voy a tratar de explicar como funciona esto:
Codigo Flash:
Código:
function getDatos(){
//creo una variable para cargar la pagina
var datos = new LoadVars();
//Variable que se envia al php en post
datos.actcab="LO QUE QUIERAS";
//genero el xml
datosxml = new XML();
//ignoro los espacios en blanco
datosxml.ignoreWhite = true;
//una ves cargado voy a la funcion recibido
datosxml.onLoad = recibido;
//mando los datos a la pagina
datos.sendAndLoad("pagina.php", datosxml, "POST");
}
function recibido(success) {
//si ha cargado la pagina con exito
if (success) {
//Si la variable statform es no
if (this.statform == "no") {
//Envio un mensaje de error a una caja de texto
Caja.text="No hay datos"; //O lo que sea xD
}else{
//Cargo el total de elementos en el xml
tot = this.firstChild.childNodes.length;
//Comienzo en el primer elemento
i = 0;
while (i<tot) {
//Cargo variables con mis elementos
//La primera es el encabezado
var tActuaciones = this.firstChild.childNodes[i].attributes["actuaciones"];
var tEst = this.firstChild.childNodes[i].attributes["est"];
var tFec = this.firstChild.childNodes[i].attributes["fec"];
var tNog = this.firstChild.childNodes[i].attributes["nog"];
var tPes = this.firstChild.childNodes[i].attributes["pes"];
var tDis = this.firstChild.childNodes[i].attributes["dis"];
var tPp = this.firstChild.childNodes[i].attributes["pp"];
var tOch = this.firstChild.childNodes[i].attributes["och"];
var tCua = this.firstChild.childNodes[i].attributes["cua"];
var tLl = this.firstChild.childNodes[i].attributes["ll"];
var tPji = this.firstChild.childNodes[i].attributes["pji"];
var tJin = this.firstChild.childNodes[i].attributes["jin"];
var tDiv = this.firstChild.childNodes[i].attributes["div"];
var tGan = this.firstChild.childNodes[i].attributes["gan"];
var tCpo = this.firstChild.childNodes[i].attributes["cpo"];
var tStu = this.firstChild.childNodes[i].attributes["stu"];
var tPre = this.firstChild.childNodes[i].attributes["pre"];
i++;
}
//Aca ya tienes todos los datos en tus variables
}
} else {
//Si no envio un mensaje de error a una caja de texto
Caja.text="no conecta";
}
}
Php:
Código PHP:
<?php
$link = mysql_connect ("localhost", "root", "");
mysql_select_db("c_virtual",$link);
/* igualamos las variables enviadas */
$caballo = $_POST['actcab'];
$resultado= mysql_query("SELECT * FROM actuaciones WHERE Act_Cab ='$caballo'") or die ("&statform=no&");
while($row = mysql_fetch_array($resultado)){
echo "<actuaciones>
<est>" . $row["Act_Estado"] . "</est>
<fec>" . $row["Act_Fecha"] . "</fec>
<nog>" . $row["Act_Numero_Gua"] . "</nog>
<pes>" . $row["Act_Cab_Peso"]. "</pes>
<dis>" . $row["Act_Distancia"] . "</dis>
<pp>" . $row["Act_PP_Inscrito"] . "</pp>
<och>" . $row["Act_Parcial_800"] . "</och>
<cua>" . $row["Act_Parcial_400"]. "</cua>
<ll>" . $row["Act_Pos_Llegada"] . "</ll>
<pjin>" . $row["Act_Jin_Corrio"] . "</pjin>
<jin>" . $row["Act_Peso_Jin_Corrio"] . "</jin>
<div>" . $row["Act_Dividendo"]. "</div>
<gan>" . $row["Act_Cab"] . "</gan>
<cpo>" . $row["Act_Cuerpos"] . "</cpo>
<stu>" . $row["Act_Stud"] . "</stu>
<pre>" . $row["Act_Preparador"]. "</pre>
</actuaciones>";
}
mysql_free_result($resultado);
?>
Ojala te sirva!
Suerte!