What is cross-domain?
Cross-domain simply means that access to other domain names of files or resources, such as a.com Flash to access b.com resources, then will cause cross-domain problems, because a.com and B.Com are not the same domain name.
Why are there cross-domain issues?
In fact, not only flash,javascript and other scripts have cross-domain issues, this is mainly the security mechanism of their own decision, because cross-domain access to some files or resources is a certain risk, he exceeded the scope of the site itself, for the outside of the resources can not audit its security, In today's increasingly rampant network virus trojan, cross-domain restricted access is an important solution to its security policy.
Code processing methods:
Flash.system.Security.allowInsecureDomain ("*"); Allow Flash to access any URL resource, if you just want to access a specific URL, you can change the * to the URL, if more than one URL, separated by a comma, Note that Allowinsecuredomain is allowed to access URL resources with authentication, such as HTTPS, which is not required if you are only accessing normal HTTP.
If you want to read an external file, such as Swf,picture,mp3 and so on, then you need a cross-domain policy file (crossdomain.xml), which is actually an XML file, the specific content is:
The code is as follows |
Copy Code |
<?xml version= "1.0"?> <cross-domain-policy> <allow-access-from domain= "www.explorechn.com"/> <allow-access-from domain= "explorechn.com"/> <allow-access-from domain= "223.4.119.191"/> </cross-domain-policy> |
This is the cross-domain policy file, allow-access-from domain represents the URL that is allowed to be accessed, if there are multiple additions, if all is allowed on a allow-access-from domain = "*".
AS3 Cross-domain issues