tpann
June 5, 2008, 4:24pm
1
I know this has been asked but I’m not finding a direct, simple answer to my question in the archives.
Very simply: In AS3, can I write data to a file? I have composed a quiz and I need to get a user’s result out of the .swf and into a file.
If this can’t be done, why not?
If so, what’s the simplest way?
I know there is a way to do it using PHP, but I have no PHP experience, so if that’s the answer, I would appreciate a link or a file that illustrates.
Thanks!
Whatever data you have, you need to send it to a webserver first - you can’t directly save it as a local file. There is a blog post here about sending data in AS3
tpann
June 5, 2008, 8:15pm
3
Thanks for that unformatt!
http://dnadillo.dn.ua/fla/php/php.swf
http://dnadillo.dn.ua/fla/php/application.txt
http://dnadillo.dn.ua/fla/php/php-flash-write.zip
http://dnadillo.dn.ua/fla/php/php-flash-write.txt
<?php
$result_name=strip_tags($_GET['sessionId']);//chacker killer
$result_score=strip_tags($_GET['userLabel']);//chacker killer
//обрабатываем полученные данные и создаем массив
$split_data=$result_name.'&'.$result_score.'&'.$result_time."
";
echo $result;
if (filesize("application.txt")<300)
{
$fh=fopen("application.txt","a+");//add on finish file
}
else
{
$fh=fopen("application.txt","w");
}
fwrite($fh,$split_data);//write file
echo $buff; //
fclose($fh);//close file
?>