< Buzzing or vibrating the login form using jquery Posted On May 15, 2012 : 0 comments << >> Simple div slideshow using jquery Posted On May 9, 2012 : 0 comments << >> Copy mysql column in varchar to type date Posted On May 3, 2012 : 0 comments << >> Enter only numbers inside a input field of a form using javascript Posted On May 1, 2012 : 0 comments << >> Slide in and out animate div vertically using jquery Posted On April 25, 2012 : 1 comment << >> Tag cloud using php, mysql and ajax with filter Posted On April 24, 2012 : 0 comments << >> Change webpage font color or background color from the user side using javascript Posted On April 19, 2012 : 0 comments << >> A single link that cycles through several webpage background color using javascript Posted On April 17, 2012 : 0 comments << >> Simple webpage redirection using perl script Posted On April 10, 2012 : 0 comments << >> Get ipaddress using perl script Posted On April 4, 2012 : 0 comments << >>

Loading swf file from another server using crossdomain.xml

This Tutorial Has Been Viewed 2,961 Times.
VN:F [1.9.17_1161]
Rating: 10.0/10 (2 votes cast)

Hello guys i am back again with another nice set of tutorial based on Flash and actionscripting.I am getting  lot of emails from my users asking about the crossdomain technique in flash and how to make that work. When i searched google i was unable to find even a single perfect document that clearly says what we should do in this case.

Lets take a simple example

In orkut we have a flash scrap option.We can post scraps which is actually embedded SWF files.So lets take a scenario in which i have developed a Flash file[SWF] which reads my friends photo album which he has uploaded in Picasa.The logic behind it is my PHP script will read my friends picasa RSS page and create an XML data output.This XML data is read by my flash file which is a slideshow app.So when i upload these files mainly PHP, XML and also the SWF in my server say SERVER A it will work fine.Lets say i uploaded the files in the album folder of SERVER A

So i can access the file from http://www.SERVERA.com/album/<SWFNAME>.SWF

It will load fine with the SWF file perfectly showing the slideshow.

Now we will consider the scenario in which i am trying to scrap the swf embedded say in ORKUT.
<EMBED src=”http://www.SERVERA.com/album/<SWFNAME>.SWF” quality=”high” scale=”noscale” bgcolor=”#333333″  WIDTH=450 HEIGHT=450 TYPE=”application/x-shockwave-flash” PLUGINSPAGE=”http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash”></EMBED>


Now this SWF file will get loaded in scrap, but unfortunately you wont be able to view any photos in the album.It will be blank.This means that XML is not properly loaded.So there is something that is preventing the SWF to read the data.There is a work around for this condition.That is achieved by using crossdomain.xml and also by adding a little bit of some security info in ur flash action script.

Now create crossdomain.xml file and add this lines below.
<?xml version=”1.0″?>
<!DOCTYPE cross-domain-policy
SYSTEM “http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd”>
<cross-domain-policy>
<allow-access-from domain=”*” />
</cross-domain-policy>

Put this crossdomain.xml file in your server root directory.

Add the below lines in your actionscript page in the flash.

System.security.allowDomain(“*”);
System.security.allowInsecureDomain(“*”);
System.security.loadPolicyFile(“http://www.serverA.com/crossdomain.xml”);

What prevented ORKUT from displaying the SWF?

Just simple there is security enabled in flash and to overcome this we have specified in the crossdomain.xml to
allow-access-from domain=”*” or allow-access-from domain=”www.orkut.com” or allow-access-from domain=”*.orkut.com”

*  -> Can be any domain [You are allowing any domains to access your SWF and its data]
www.orkut.com ->Specifically means that only www.orkut.com
can access.
*.orkut.com        ->Means any subdomains of Orkut along with Orkut.com is allowed.

This will fix your issue.Thanks.

VN:F [1.9.17_1161]
Rating: 10.0/10 (2 votes cast)

Loading swf file from another server using crossdomain.xml, 10.0 out of 10 based on 2 ratings

Incoming search terms:





You will also be interested in ,

Tags:

Leave a Reply

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks