User Guide
LoadVars class 315
LoadVars class
Availability
Flash Player 6.
Description
You can 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. You can
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.
For information about using the LoadVars class and example code, see “Using the LoadVars class”
on page 69.
Method summary for the LoadVars class
Method Description
LoadVars.addRequestHeader()
Adds or changes HTTP headers for POST operations.
LoadVars.decode()
Converts a variable string to properties of the specified LoadVars
object.
LoadVars.getBytesLoaded()
Returns the number of bytes downloaded by LoadVars.load() or
LoadVars.sendAndLoad().
LoadVars.getBytesTotal()
Returns the total number of bytes that will be downloaded by a load
or
sendAndLoad method.
LoadVars.load()
Downloads variables from a specified URL.
LoadVars.send()
Posts variables from a LoadVars object to a URL.
LoadVars.sendAndLoad()
Posts variables from a LoadVars object to a URL and downloads
the server’s response to a target object.
LoadVars.toString()
Returns a URL-encoded string that contains all the enumerable
variables in the LoadVars object.
CHAPTER 6
ActionScript Core Classes