User Guide

LoadVars 699
if (lvBytesTotal != undefined) {
trace("Loaded "+lvBytesLoaded+" of "+lvBytesTotal+" bytes.");
loadvars_pb.setProgress(lvBytesLoaded, lvBytesTotal);
}
};
my_lv.onLoad = function(success:Boolean) {
loadvars_pb.setProgress(my_lv.getBytesLoaded(), my_lv.getBytesTotal());
delete timer_mc.onEnterFrame;
if (success) {
trace("LoadVars loaded successfully.");
} else {
trace("An error occurred while loading variables.");
}
};
my_lv.load("[place a valid URL pointing to a text file here]");
See also
load (LoadVars.load method), sendAndLoad (LoadVars.sendAndLoad method)
load (LoadVars.load method)
public load(url:String) : Boolean
Downloads variables from the specified URL, parses the variable data, and places the resulting
variables in
my_lv. Any properties in my_lv with the same names as downloaded variables are
overwritten. Any properties in
my_lv with different names than downloaded variables are not
deleted. This is an asynchronous action.
The downloaded data must be in the MIME content type application/x-www-form-urlencoded.
This is the same format that is used by
loadVariables().
Also, in files published for Flash Player 7, case-sensitivity is supported for external variables
that are loaded with
LoadVars.load().
This method is similar to
XML.load().
When using this method, consider the Flash Player security model:
For Flash Player 8:
Data loading is not allowed if the calling SWF file is in the local-with-file-system sandbox
and the target resource is from a network sandbox.
Data loading is also not allowed if the calling SWF file is from a network sandbox and the
target resource is local.
NOTE
If a file being loaded contains non-ASCII characters (as found in many non-English
languages), it is recommended that you save the file with UTF-8 or UTF-16 encoding as
opposed to a non-Unicode format like ASCII.