Devo fare un passo indietro: non riesco a collegare tra loro php e actionscript.
Il file php mi recupera i dati dal DB però poi non riesco a vederli in flash.
Il codice php è il seguente:
Codice PHP:
<?php
// dati per la connessione al database
$db_host = "localhost";
$db_user = "";
$db_password = "";
$db_name = "test";
// connessione al database
$db = mysql_connect ($db_host, $db_user, $db_password);
$db_forum = mysql_select_db ($db_name, $db);
$query = "SELECT `nome`, `cognome`, `anni` FROM `album_elite` ";
$query_results = mysql_query($query);
$i = 0;
while($fetch = mysql_fetch_array($query_results))
{
$i++;
echo "&nome".$i."=".$fetch['nome']."
";
echo "&cognome".$i."=".$fetch['cognome']."
";
echo "&anni".$i."=".$fetch['anni']."
";
}
if($i)
{
echo "&i=".$i;
echo "&ok=1";
echo "&stop=1";
}
else
{
echo "&ok=0";
echo "&stop=1";
}
?>
Poi il codice actionscript che ho associato ad un pulsante è il seguente:
Codice PHP:
on(release)
{
loader = new loadVars();
loader.load("connect.php");
loader.onLoad = function(success) {
if(success)
{
if(this.ok)
{
_root.nome.htmlText = "";
_root.cognome.htmlText = "";
_root.anni.htmlText = "";
for(var j = 1; j <= this.i; j++)
{
_root.nome.htmlText += eval("this.nome" + j);
_root.cognome.htmlText += eval("this.cognome" + j);
_root.anni.htmlText += eval("this.anni" + j);
}
_root.output.text = "ok";
}
else
{
_root.nome.htmlText = "";
_root.cognome.htmlText = "";
_root.anni.htmlText = "";
_root.output.text = "error";
}
}
}
}
Ho fatto una prova con semplice testo per partire dal semplice (poi dovrò farlo con le immagini).
Il tutto non funziona dove sbaglio?
Grazie mille