PDA

View Full Version : From Flash to PHP and Back Again



Ringer
November 6th, 2004, 03:53 PM
Cheesy title.

I want to send Flash data to a .php. I learned how with this:

http://www.kirupa.com/developer/actionscript/displayinphp.htm

However, I want the .php to then write the variables to a .txt. That way, Flash can read the data back from the .txt. I don't want to open any browser windows; I just want to recieve my data in Flash.

If you recommend an entirely different method, I'd be grateful for that, too. If this is the wrong forum, castigate me to the max.

Digitalosophy
November 6th, 2004, 05:23 PM
This would be the same techinque as writing a question book without mySQL. I'd suggest searching google, the forums, and the tutorial sections. Tons of resources everywhere on this.

Ringer
November 6th, 2004, 06:32 PM
Erm, I'll do some more looking around, but this forum isn't my first stop. If someone would go so far as to put down the script itself for me it'd be really nice. Thanks anyway, and I'll be back to check in a little while.

Ringer
November 8th, 2004, 02:04 AM
Okay, good. I got some help. :book: This is my PHP file:


<?
$file1 = "info";
$file2 = ".txt";
$file = "$file1$_POST['id']$file2";
$info = "x=$_POST['x']&y=$_POST['y']&name=$_POST['name']&rotation=$_POST['rotation']";
$handle = fopen('$file', 'a');
chmod($file, 0777);
fwrite($handle, $info);
fclose($handle);
echo"$file - $info";
?>

It creates a txt called info[id].txt, right? It writes in the variables x, y, name, and rotation. But, it hasn't gotten those variables from anywhere, and the txt has nothing to pick them up. IN FLASH: (let's start from a clean slate here) what do I need to DO in Flash? I want to pass all these variables to the PHP, write them to the txt (done and good), and have Flash read a txt set up by SOME OTHER system like this. Specifically, to allow two people to interact via Flash movies. Here's my hackneyed flowchart:

swf1 -----> php1 -----> txt1
. ^ . . . . . . . . . . . . . . . . v
txt2 <----- php2 <----- swf2