FLASH PHP doesnt update properly
hi there, I am writing in a text file and then receiving the data in a Flash text field using PHP
http://www.reitera.net/mmmphp/aver.swf i know it's quite lame, but it is just a test.
Couldnt fine a way to work it out, so a made something bad in onEnterFrame as you might see.
AS
envia.onRelease = function ()
{ enviando = "si";
estado = "enviando";
loadVariablesNum ("escribir.php", 0 , "POST");
}
carga = function () {
cargatexto = new LoadVars();
cargatexto.load("escribir.php");
cargatexto.onLoad = function (succes) {
if (succes) {
{display.html = true;
display.htmlText= this.output;
}
}
}}
carga();
this.onEnterFrame = function ()
{if (estado == "escrito") {
estado = "escrito";
carga();
}}
PHP
<?
$archivo = "escribir.txt";
$fs = filesize($archivo);
$fp = fopen($archivo, "r");
$salida = fread($fp, $fs);
echo"&output=$salida";
fclose($fp);
if ($enviando == "si")
{
$fs = filesize($archivo);
$fp = fopen ($archivo, "r");
if ($fp)
{
$antiguo = fread($fp, $fs);
fclose($fp);}
$fw = fopen($archivo, "w+");
if ($fw)
{echo"&estado=escribiendo";
fwrite($fw, "$entrada$antiguo");
$fc = fclose($fw);
if ($fc)
{echo"&estado=escrito";}
}
}
?>
I am sorry about the Spanish variables names.
Any ideas?
__________________
www.reitera.net