Flash actionscript - save a text file on server
Good day to all. I have a little problem.
Can anyone tell me or give a link or something on how to save a text file on the server with some data a user inserted?
I need to do this: I have a text box and after pressing enter I need to create/append a file with a log of what a user en开发者_如何学Pythontered. I have created the box, add listener but I don't know how to create the file. Thank you for help.
Use flash.net.URLRequest
to send the data to a script on the server that saves the data to a file.
The Flash Player cannot access the server directly, as it runs on the client computer, so you need to do it that way.
Example
// prepare the data to send, for example in a URLVariables object.
var vars:URLVariables = new URLVariables();
vars.userId = 1234;
vars.enteredData = 'Hello World';
// construct the URL request
var req:URLRequest = new URLRequest( 'myscript.php' );
req.method = URLRequestMethod.POST;
req.data = vars;
// open the URL request (you can for example listen to events and
// evaluate the script's response data etc)
var loader:URLLoader = new URLLoader( req );
精彩评论