LoadVars class 425
LoadVars class
Availability
Flash Player 6.
Description
The LoadVars class is an alternative to the loadVariables() function for transferring variables
between a Flash application and a server.
You can use the LoadVars class to obtain verification of successful data loading, progress
indications, and stream data while it downloads. 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.
Method summary for the LoadVars class
Property summary for the LoadVars class
Event handler summary for the LoadVars class
Method Description
LoadVars.addRequestHeader() Adds or changes HTTP headers for POST operations.
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.
Property Description
LoadVars.contentType Indicates the MIME type of the data.
LoadVars.loaded A Boolean value that indicates whether a load or sendAndLoad
operation has completed.
Event handler Description
LoadVars.onData Invoked when data has been completely downloaded from the server,
or when an error occurs while data is downloading from a server.
LoadVars.onLoad Invoked when a load or sendAndLoad operation has completed.