0

I need to host my full-Flash SWF site on "xx.com" server. But all graphics and sounds have to be loaded off "yy.com" server.

Inside my AS3 code, all data is loaded by absolute addresses, e.g:

http://yy.com/file1.jpg
http://yy.com/file2.jpg

If I run the swf locally, either from within the Flash authoring tool, or a local .html file, or by double-clicking the swf, it works fine. All data is downloaded from "yy.com" and the site displayed properly.

It WON'T work if I upload the swf on "xx.com" and load it off there.

I have created the following crossdomain.xml file

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
    <site-control permitted-cross-domain-policies="all"/>
    <allow-access-from domain="*" />
</cross-domain-policy> 

and uploaded at

http://yy.com/crossdomain.xml

The result is quite strange : it seems to start loading 1-2 images off "yy.com", but then it halts. This behaviour happens with or without the crossdomain.xml file.

Is what I am trying to do achievable in some way? My problem is that xx.com has very limited space so I can upload the swf and/or the html on it, but not the actual data (which is lots of MBs).

Bill Kotsias
  • 3,258
  • 6
  • 33
  • 60
  • Try installing Fiddler Web Debugger if your on windows or Charles if your on a Mac. Take a look and see if the crossdomain file is accessed. Then check if the assets are accessed. – Adam Harte Mar 29 '12 at 20:57
  • Is your swf served via https? If so, you'll need `secure="false"` in your cross-domain.xml – Marty Pitt Mar 29 '12 at 21:11
  • Also, check to see if the debugger is giving any errors - normally, if it is a cross-domain issue, you should be getting a security sandbox error thrown in the debug console. – Marty Pitt Mar 29 '12 at 21:12

3 Answers3

1

try using this as your crossdomain.xml file. This is the one I use and it has always worked for me. It has that extra allow-http-request-headers-from node

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy>
    <site-control permitted-cross-domain-policies="all"/>
    <allow-access-from domain="*" />
    <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
Ronnie
  • 11,138
  • 21
  • 78
  • 140
1

Make sure you set allow all inside your swf's

Security.allowDomain("*");
francis
  • 5,889
  • 3
  • 27
  • 51
0

The solution was to add a LoaderContext to the load function of the Loader objects, like this :

context = new LoaderContext(true);
loader.load( new URLRequest(name),  context );

Only then was the crossdomain.xml file checked.

Bill Kotsias
  • 3,258
  • 6
  • 33
  • 60