Flash actionscript - save a text file on server

↘锁芯ラ 提交于 2019-12-04 18:17:48

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 );
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!