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.
Incoming search terms:
- orkut crossdomain xml (5)
- embed swf from another server (4)
- embedding a swf from another server (4)
- load swf from another server (4)
- loading a swf from another server (3)
- load swf another server (3)
- tutorial swf load cross domain (3)
- embed xml swf to another website (2)
- swf other server (2)
- embed a swf from another site (2)
- flash swf on different server (2)
- crossdomain xml example on xampp (2)
- crossdomain xml xampp (2)
- lz embed tutorial (2)
- embedded swf another server (2)
- embed swf from another site crossdomain (2)
- lz embed swf crossdomain (2)
- how to load swf to flash from other server (2)
- Html <embed src not loading swf file on first hit (2)
- loading a swf from another site example (1)
- load xml from server in swf as3 (1)
- load xml swf using javascript (1)
- loading an swf from another domain with js (1)
- loading cross-domain swf as3 (1)
- loading font from different domain actionscript 2 (1)
- loading swf file from a different server (1)
- loading swf from another server crossdomain xml (1)
- Loading swf from swf from another server (1)
- Loading XML file from another server (PHP) (1)
- loading files from another server flash (1)
- load swf xml example (1)
- load swf into xml example (1)
- load swf from xml (1)
- load flash from another domain jquery (1)
- load external swf from another server (1)
- load crossdomain other server (1)
- load a swf from another server (1)
- jquery how to load a different xml in a swf (1)
- install crossdomain xampp (1)
- image upload in php and mysql / javascript swf (1)
