User Guide

LoadVars class 95
Example
The following example loads a text file and writes information to the log file when the
operation completes:
var my_lv = new LoadVars();
my_lv.onLoad = function(success) {
trace("LoadVars loaded successfully: "+this.loaded);
};
my_lv.load("http://www.helpexamples.com/flash/params.txt");
See also
LoadVars.onLoad
LoadVars.onData
Availability
Flash Media Server 2.
Usage
myLoadVars.onData(src){}
Parameters
src A string or undefined; the raw (unparsed) data from a LoadVars.load() or
LoadVars.sendAndLoad() method call.
Description
Event handler; invoked when data has completely downloaded from the server or when an
error occurs while data is downloading from a server. This handler is invoked before the data
is parsed and can be used to call a custom parsing routine instead of the one built in to Flash
Player. The value of the
src parameter passed to the function assigned to LoadVars.onData
can be either undefined or a string that contains the URL-encoded name-value pairs
downloaded from the server. If the
src parameter is undefined, an error occurred while
downloading the data from the server.
The default implementation of
LoadVars.onData invokes LoadVars.onLoad. You can
override this default implementation by assigning a custom function to
LoadVars.onData,
but
LoadVars.onLoad is not called unless you call it in your implementation of
LoadVars.onData.