Forse ho trovato la soluzione......
http://www.actionscript.it/forum/showthread.php?t=9058
http://forum.html.it/forum/showthrea...ghlight=loadva rs
E' necessaio modificare il codice PHP inserendo header:
Codice PHP:
Codice PHP:
<?
$myresult="n=10";
ob_start();
for($a=0;$a<10;$a++)
$myresult.="&riga".$a."=img".$a;
echo $myresult;
header("Content-Length: ".ob_get_length());
ob_end_flush();
?>
Actionscript come segue:
Codice:
codice:
LoadVars.prototype.checkHeader = function() {
this.idHeader = setInterval(this, "getTotal", 10);
};
LoadVars.prototype.getTotal = function() {
if (this.getBytesTotal() != undefined) {
this.onStart();
this.idLoading = setInterval(this, "getLoading", 10);
clearInterval(this.idHeader);
}
};
LoadVars.prototype.getLoading = function() {
this.onLoadProgress();
if (this.getBytesLoaded()>=this.getBytesTotal()) {
clearInterval(this.idLoading);
}
};
this.preload._visible = false;
result = new LoadVars();
result.load("prova.php");
result.checkHeader();
result.onLoadProgress = function() {
_root.textField3.text = "caricati: "+this.getBytesLoaded();
_root.textField4.text = "totali: "+this.getBytesTotal();
};
result.onStart = function() {
this.startTime = getTimer();
_root.textLabel1.text = "inizio flusso";
_root.preload.loadVarsObject = this;
_root.preload.totalBytes = this.getBytesTotal();
_root.preload.onEnterFrame = function() {
this.loadedBytes = this.loadVarsObject.getBytesLoaded();
this.percent = this.loadedBytes/this.totalBytes*100;
this.barra._xscale = this.percent;
this._visible = true;
this.text1.text = "Percentuale: "+Math.round(this.percent)+"%";
this.text2.text = "Bytes caricati: "+this.loadedBytes;
if (this.loadedBytes == this.totalBytes) {
delete this.onEnterFrame;
}
};
};
result.onLoad = function() {
_root.prova.text=result["n"];
_root.textLabel2.text = "fine flusso, bytes scaricati: "+this.getBytesLoaded()+" in "+(getTimer()-this.startTime)+"ms";
//play();
};