Loading image from other domain (crossdomain issue)

Author: Last Update: 18/08/2008

The course of issue.

For security reasons, a Macromedia Flash movie playing in a web browser is not allowed to access data that resides outside the exact web domain from which the SWF originated.

As an enhancement to Macromedia Flash Player 7, domains must be identical for data to be read. With this change a sub-domain can no longer read data from a parent domain and vice versa.

You can visit here for more details.

http://www.adobe.com/go/tn_14213

 

Adding crossdomain.xml to your server. 

1. Open a text editor or other editor. Fill in the text below and save it with filename "crossdomain.xml".  ( www.company.com should replaced with your domain which contains the files you want to load)

<?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="www.company.com" secure="false" />

</cross-domain-policy>

 2. Upload the crossdomain.xml to the root of the server. Which the crossdomain.xml can be access with path www.company.com/crossdomain.xml

 

Use Proxy Method to solve the issue.

If you are placing your website in a hosting which not allow you to put crossdomain.xml, you can use this proxy method.

1. Setup a working components wihch can run locally

2. Open a text editor or other editor. Fill in the script below and save it with filename "proxy.php". Place it in the directory which your flash html in.

<?php
//note that this will not follow redirects
readfile($_GET['dataURL']);
?>

3. Open your flash project and select our components. In components inspector, fill in the proxy field with "proxy.php".

4. Publish your movie.

6. Upload all swf, html and php on the web server.