Flash cross-Domain call WebService implementation method

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.