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]");
LoadVars.load()
Availability
Flash Player 6; behavior changed in Flash Player 7.
Usage
my_lv.load(url:String) : Boolean
Parameters
A string; the URL from which to download the variables. If the SWF file issuing this call is
url
running in a web browser,
Description section.
Returns
A Boolean value;
Description
Method; downloads variables from the specified URL, parses the variable data, and places the
resulting variables into
variables are overwritten. Any properties in
variables are not deleted. This is an asynchronous action.
The downloaded data must be in the MIME content type application/x-www-form-urlencoded.
The value you pass for
www.someDomain.com can load data only from sources that are also at www.someDomain.com.
If you want to load data from a different domain, you can place a cross-domain policy file on the
server hosting the SWF file. For more information, see "Applying Flex Security" in Developing
Flex Applications.
This method is similar to
Example
The following code defines an
Flash application from a server-side PHP script, and then loads the data in passvars.php.
must be in the same domain as the SWF file; for details, see the
url
if no parameter is specified,
false
. Any properties in
my_lv
must be in exactly the same domain. For example, a SWF file at
url
.
XML.load()
handler function that signals when data is returned to the
onLoad
otherwise.
true
with the same names as downloaded
my_lv
with different names than downloaded
my_lv
LoadVars.load()
321
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?