Hi,
You will need to understand the use of the loadVars class as well as the sendAndLoad methods in Flash. You will probably want to go with PHP as it is a server side language and adept at data transfer.
The basics...
Code:
//create a loadVars object to BOTH send and receive data
myVars=new LoadVars();
//create a load check function to tell when the object has
//populated withnew data
myVars.onLoad=function(success){
if(!success){
trace("Failed to load!"){
}else{
//establish and retrieve data here
myVariable=this.setVariable;
}
}
}
Then, from a button event or other....
Code:
myButton.onRelease=function(){
myVars.sendAndLoad("myFile.php", _root.myVars,"POST")
}
Writing data to a text file would be done with PHP. Something like...
PHP code...
Code:
<?
//Register variables sent from the flash movie
$myFileName=$_POST["myFileName"];
$article=$_POST["article"];
//open the text file,write the data sent,close the file
$fp = fopen ("$myFileName", "w+");
fwrite($fp,"$article");
fclose($fp);
//check success and echo message back to flash
if ($fp) {
echo ("&msg=Save Successful!&name=$name&myTextSave=$myTextSave");
} else {
echo ("&error=OK&msg=Save unsuccessful!...an error occurred!");
}
?>
Regards
NTD
Bookmarks