Skip navigation
JonoB
Currently Being Moderated

Adobe Flex unable to load images from Amazon S3

Feb 27, 2012 3:03 PM

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

    <cross-domain-policy>

      <site-control permitted-cross-domain-policies="master-only" />

      <allow-access-from domain="*" />

      <allow-http-request-headers-from domain="*" />

    </cross-domain-policy>

 

I then tried the following:

 

Security.loadPolicyFile('http://mybucket.s3.amazonaws.com/crossdomain.xml');

Security.allowInsecureDomain('http://mybucket.s3.amazonaws.com/');

Security.allowDomain('http://mybucket.s3.amazonaws.com/');

 

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?

 
Replies
  • Currently Being Moderated
    Feb 27, 2012 3:39 PM   in reply to JonoB

    Use a network monitor to make sure the request is going out correctly.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 27, 2012 4:00 PM   in reply to JonoB

    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).

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 27, 2012 11:21 PM   in reply to JonoB

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points