php to .txt to flash
Posted: Wed Jan 21, 2009 9:32 am
I have created a Flash file that sends text to a flat .txt file via php and displays the contents of the entire .txt file in a separate window. Basically it's a sign up sheet for a sports team. I'm capturing the data in Flash using:
my php reads:
THE PROBLEM:
It will eventually update the .txt file, eventually meaning anywhere from 1-5 minutes. However, if I open the text file in a separate browser window and hit refresh it will update immediately and send the data back to my Flash presentation. I'm wondering why the delay unless I kick start it in the browser. How can I get instant gratification and have the text file update immediately without intervention through the browser. My Flash presentation is time sensitive and the information displayed needs to be current and immediate.
Thanks in advance for suggestions.
Burrito: Please use PHP tags when posting code in the forums.
Code: Select all
// on submit:
myVars=new LoadVars();
my Vars.name=name_txt.text;
myVars.sendAndLoad("sendinfo.php", myVars, "POST");
Code: Select all
<html>
<body>
<?php
// To reset the .txt file via admin interface //
$evaluate=$_POST['evaluate'];
if($evaluate=="admin") {
$open = fopen("savedinfo.txt","w+");
$text = "blog=";
fwrite($open, $text);
fclose($open);
/////////////////////////////////////
} else {
$user = $_POST["name"];
$out = fopen("savedinfo.txt", "a");
fputs ($out,implode,("\n"));
fwrite($out, $user."\n");
fclose($out);
}
?>
</body>
</html>
It will eventually update the .txt file, eventually meaning anywhere from 1-5 minutes. However, if I open the text file in a separate browser window and hit refresh it will update immediately and send the data back to my Flash presentation. I'm wondering why the delay unless I kick start it in the browser. How can I get instant gratification and have the text file update immediately without intervention through the browser. My Flash presentation is time sensitive and the information displayed needs to be current and immediate.
Thanks in advance for suggestions.
Burrito: Please use PHP tags when posting code in the forums.