I have a flex 3 app that is attempting to load images from Amazon S3. The images fail to load, so I fired up debug mode. In debug mode, the images load, but I also get the following output in the debugger:
*** Security Sandbox Violation ***
SecurityDomain 'http://mybucket.s3.amazonaws.com/logos/mylogo.png' tried to access incompatible context 'http://localhost/myapp/bin-debug/index.html?debug=true'
I have added a crossdomain.xml file into the root of my bucket as follows, but this does not seem to help:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<site-control permitted-cross-domain-policies="master-only" />
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" />
I then tried the following:
At this point, it seems that there are not any more errors reported in debug mode. However, when not in debug mode, then the image still does not load.
Am I missing something obvious here?
Thanks for the reply.
Using Charles does not show any request going out when the image is loaded. However, it is loaded correctly when in debug mode (even though I cant see the request in Charles). So, I know that the request is definately going out, and a response is coming back in. I have no idea on whether that is due to a bug in Charles or not, but it seems irrelevant.
Its only when not in debug mode that it fails to load the image.
If you run the debug version, does Charles show the request? Lots of folks have issues with a release build being deployed differently or built differently and running different code paths. There are far fewer people that have issues with different security between release and debug when loading images (other than deploying to different URLs/servers).
OK, I think that you are on the right track.
I tried another method (using a proxy.php file as described at http://active.tutsplus.com/tutorials/actionscript/quick-tip-using-a-ph p-proxy-to-load-assets-into-flash/). Using this method, I can quite clearly see the call when using debug mode, but its clearly trying to make a different (incorrect) call in normal mode.
This has me completely stumped, as I have never built any custom code paths or builds or anything like for debug vs normal mode.
If you are not getting creationComplete in release vs debug builds, it is best to try to identify the differences between the two runtime environments.
Is the URL to the SWF the same? Some folks find that their release folder is missing some important file.
Is the URL to the HTML wrapper the same? Some folks launch their debug from file:// and their release from http:// which have different security rules
Is the launch step the same? Some folks launch their debug from FlashBuilder and their export via some other mechanism. This can alter the initial size of the app and that difference can cause some apps to get into a “layout loop” and never hit creationComplete. To find out if you are in such a loop, report calls to updateDisplayList, and measure() on various compoonents and see if they keep getting called.
Is there a timing difference? Some apps may have subtle timing dependencies that change when the release build runs faster.
Thanks for the suggestions. I eventually figured out that for some unknown reason the normal compile was not being created correctly in the bin folder, despite me clearing the browser cache many times. I eventually had to delete the bin folder and let flex re-create it. Weird to say the least, given that I have compiled many thousand times without this ever happening.
Meh. I hate flex.