I am currently developing an Flash Movie which sends a simple POST request with a few parameters to a PHP URL. The only problem is that I am not sure which of two (loadVariables & LoadVars) methods I should use. What are the pros and cons?
LoadVarsclass is an alternative to the
loadVariables()function for transferring variables between a Flash Lite and a web server over HTTP. Use the
LoadVarsclass to obtain verification of successful data loading and to monitor download progress.
LoadVarsclass 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.onLoadhandler 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
sendAndLoad()to communicate with a server. The main difference between the
LoadVarsclass and the XML class is that
LoadVarstransfers ActionScript name and value pairs, rather than an XML DOM tree stored in the XML object. The
LoadVarsclass follows the same security restrictions as the XML class.
- Copied verbatim from Adobe Flash Platform - LoadVars
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:
- Copied verbatim from Adobe Flash Platform - loadVariables Function