Data | download
Function description
Download the data from the specified URL address and parse the contents of the data and store the results in the loadvarsobject. All downloaded variable contents are stored in Loadvarsobject in the form of a property, and the variable name is the property name of the Loadvarsobject, whose contents are case-sensitive. Therefore, any property name in Loadvarsobject that has the same name as the variable named in the download will be overwritten, and vice versa. These actions do not occur synchronously.
The downloaded data will be formatted as a string that conforms to the application/x-www-urlform-encoded specification, in the same format as loadvariables, such as: Name= frankc&age= 26&sex= Male, this data is also the return value of the data.
In the player prior to Flash version 7.0, use this method to read the specified SWF file to be accessed as long as all SWF files are located under the same parent domain.
In Flash version 7.0, however, when you use this method to read the specified SWF file to be accessed, you must specify the exact domain address. For example: SWF file in www.myDomain.com, can only access www.myDomain.com other SWF files, inaccessible example.myDomain.com files.
If you are accessing a different domain, you must place an XML file of the Cross-domain principle file (cross-domain Policy file) in the stored swf file.
The sample format is as follows:
<?xml version= "1.0"?>
<!--Http://www.myDomain.com/crossdomain.xml-->
<cross-domain-policy>
<allow-access-from domain= "www.SomeOf domain.com"/>
<allow-access-from domain= "*.mydomain.com"/>
<allow-access-from domain= "123.123.123.123"/>
</cross-domain-policy>
The function of this method is similar to that of Xml.load, and its security restrictions are the same.
Grammar
Myloadvars.load (URL);
Parameters
URL: The source address of the data to download
Statement Example
Myloadvars.load (http://www.myweb.com/my.php); Download the data from the www.myweb.com/my.php URL to the Myloadvars value object.
Use
Downloading data from a specified URL address
application Example
Script on the scene frame
Stop ();
LV = new Loadvars ();
Lv.load ("Data.txt");
Script on the button
On (release) {
if (lv.loaded = = True) {
NextFrame ();
}
}
Execution results
Click the button, the program will first determine whether the external variable value has been loaded, if the load will appear a new screen and display its value.