loadVariables() 和 LoadVars

loadVariables() and LoadVars

我目前正在开发一个 Flash 电影,它将带有一些参数的简单 POST 请求发送到 PHP URL。唯一的问题是我不确定应该使用两种(loadVariables 和 LoadVars)方法中的哪一种。有什么优缺点?

LoadVars Class:

The LoadVars class is an alternative to the loadVariables() function for transferring variables between a Flash Lite and a web server over HTTP. Use the LoadVars class to obtain verification of successful data loading and to monitor download progress.

The LoadVars class lets you send all the variables in an object to a specified URL and load all the variables at a specified URL into an object. It also lets you send specific variables, rather than all the variables, which can make your application more efficient. Use the LoadVars.onLoad handler to ensure that your application runs when data is loaded, and not before.

The LoadVars class works much like the XML class; it uses the methods load(), send(), and sendAndLoad() to communicate with a server. The main difference between the LoadVars class and the XML class is that LoadVars transfers ActionScript name and value pairs, rather than an XML DOM tree stored in the XML object. The LoadVars class follows the same security restrictions as the XML class.

- Copied verbatim from Adobe Flash Platform - LoadVars

loadVariables函数:

Reads data from an external file, such as a text file or text generated by ColdFusion, a CGI script, Active Server Pages (ASP), PHP, or Perl script, and sets the values for variables in a target movie clip. This action can also be used to update variables in the active SWF file with new values.

The text at the specified URL must be in the standard MIME format application/x-www-form-urlencoded (a standard format used by CGI scripts). Any number of variables can be specified. For example, the following phrase defines several variables:

company=Macromedia&address=600+Townsend&city=San+Francisco&zip=94103

- Copied verbatim from Adobe Flash Platform - loadVariables Function