Search code examples
apache-flexactionscriptflashcrossdomain.xml

SWF Access Across Domains


I have a SWF that contacts a php script all on the same domain. In the first case both are hosted behind the same domain and communicate with no problem. Everything is working great.

However when I take the same markup that embeds the SWF and paste it on another site (using a full qualified path for the swf in both the locally hosted and remotely hosted code), the SWF no longer communicates with the php script I wrote.

I added a cross domain file to my site which looks like this.

<?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>

I added this cross domain file to both the root of my hosted domain and also to the directory where the swf is being hosted. However neither have fixed the problem. Can someone tell me why my SWF isn't communicating with my PHP script and how I can get it working?


Solution

  • allowScriptAccess is an embed parameter for letting the SWF use javascript in its containing DOM. so it won't affect cross domain access.

    the crossdomain.xml file should be all you need to add to the webroot of the external domain that the SWF is trying to communicate with.

    Can you double check that you are not getting a 404 error or some other HTTP problem when trying your crossdomain communication? are any error exceptions being thrown that can help you debug the issue.

    Post a link if you can.