Use Crossdomain.xml to allow flash to transfer data across domains
Crossdomain.xml file format
The crossdomain.xml format is very simple, and its root node is <cross-domain-policy>, which contains one or more <allow-access-from>
Node,<allow-access-from> has an attribute domain whose value is the allowed access
Allow access to any domain. For Crossdomain.xml file storage location, it is recommended to store it in the site root directory!
Example
1.SWF file main ActionScript:
| The code is as follows |
Copy Code |
On (release) { var myvar = new Loadvars (); MYVAR.T = T2.text; Myvar.sendandload ("http://www.111cn.net/", MyVar, "post"); Myvar.onload = function (re) { if (re) { T1.text = myvar.t; }else{ T1.text = "Fail ..."; } } } |
2.test.asp Code:
| The code is as follows |
Copy Code |
<% Dim T t = Request.Form ("T") Response.Write ("t=" & T & "back!") %> |
SWF files located in the www.AAA.com domain to access www.BBB.com files, the SWF first checks to see if the BBB server directory has
Crossdomain.xml file, if not, the access is unsuccessful, if Crossdomain.xml file exists, and the inside is set to allow www.AAA.com domain visit
Q, then communication is normal. So to enable flash to transfer data across the domain, the key is crossdomain.xml.