Ciao a tutti.
Sto cercando di capire come funziona l'integrazione tra php e flash.
Ho scaricato i file relativi ad un tutorial...e lui stesso non mi funziona!!!
Allora. il fla ? composto da un input text chesi chiama
years, da un pulsante che si chiama
myBtn e da una dynamic text che si chiama
output
Il file php che deve interagire con il flash si chiama
dogyears.php
ed ? cos? fatto:
Codice:
<?php
$calculation = $_POST['years']*7;
echo "&returnVal=$calculation";
?>
nel primo frame ho inserito:
Codice:
stop();
//=================================
// INIT
//=================================
//declare path to php files
lvOut = new LoadVars(); //create lv object
lvIn = new LoadVars(); //create lv object
lvIn.onLoad = function (success) {
if(success){
output.text = lvIn.returnVal;//PHP variable value to textbox
}else{
output.text = "fail"; //or notify of failure
}
}
//=================================
// BTN
//=================================
myBtn.onRelease = function(){
lvOut.years = years.text; //assign user-input value to lv property called years
//lvOut.send(path + "dogyears.php","_blank"); //send to a blank window
lvOut.sendAndLoad(path + "dogyears.php", lvIn, "POST"); //get results returned to lvIn
};
Ora se eseguo il codice php stand alone, passando con POST il valore years=7, ottengo come risultato (ovvio):
Se invece eseguo il flash, nella casella dynamic text ottengo come risultato:
Codice:
$calculation";
?>
da quello che so dovevo leggere il numero
49
Allora mi chiedo:
1) ? configurato male apache?
2) ? configurato male php
3) ? configurato male flash
4) ? errato il codice?
Grazie per l'aiuto!!