|
-
Jun 16th, 2006, 05:34 AM
#1
Thread Starter
Frenzied Member
from flash to php and vice versa
ok, here is what i was trying to do. i wanted to use php backend for flash to read and write in text files. but there is a problem.
my flash actionscript:
Code:
fname="ca.txt";
_root.strText="Loading... Please wait...";
loadVariablesNum("readMain.php?fname="+fname,0,"GET");
and my php code:
Code:
<?
#read the main file for contents
#first open the file
$fname=$_GET["fname"];
if ($fname == "") {
$fname="ca.txt";
}
$file=fopen($fname,"rb");
#read from file and close it
$mtext=fread($file,filesize($fname));
fclose($file);
echo "strText="+$mtext;
?>
its not working. the flash shows the loading part and halts.
what am i doing wrong?
-
Jun 16th, 2006, 11:53 AM
#2
Re: from flash to php and vice versa
First off, all variables your PHP script returns are not formed correctly. All variables for Flash to use must begin with an &
So it should look like
Also, you should add an &eof=true at the end of the file. That way, you can tell when it finished loading the text (it's not instant and usually takes a few frames to do so).
-
Jun 16th, 2006, 03:05 PM
#3
Addicted Member
Re: from flash to php and vice versa
you could just use flash vars in the object code in ur webpage... so you could have php generate the flash vars code.... then you wouldnt have to worry about files..
-
Jun 16th, 2006, 04:03 PM
#4
<?="Moderator"?>
Re: from flash to php and vice versa
Have you looked into load XML from flash, then all you would need to do would be to ouput the data in an XML format from your PHP script.
-
Jun 16th, 2006, 10:29 PM
#5
Re: from flash to php and vice versa
 Originally Posted by Latin4567
you could just use flash vars in the object code in ur webpage... so you could have php generate the flash vars code.... then you wouldnt have to worry about files..
That's just what I showed him how to do and what he was trying to do...
-
Jun 18th, 2006, 07:51 AM
#6
Thread Starter
Frenzied Member
Re: from flash to php and vice versa
worked..
changed the last line
Code:
echo "strText="+$mtext;
to
Code:
print "$strText=$mtext";
thanx people
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|