SecurityError: Error #2122: Security sandbox violation: _: _ cannot access _. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.

SecurityError: Error #2122: Security sandbox violation: Loader.content: http://… cannot access …jpg. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.

Description
Your project is requesting a resource that’s outside of it’s security sandbox.

Causes
Requesting an image or resource from another domain than the domain your application is on.
Attempting to modify an image usually by setting the smoothing property to true on an image or resource with limited access from another domain.
Requesting an image from an allowed domain but then that domain redirects the request to another domain.

Solutions
Simply enabling the checkPolicyFile on the loader, bitmap or Image to true may fix it. This needs to be set before attempting to access the resources. See example code below.
Putting a cross domain policy file on the other server.
Using a proxy on your own server.
Setting the HTML embed code to allow remote domain and local domain (have to verify this).

Here are additional resources. Remember that this is an area that is little understood. Some of the resources may contain incorrect information while at the same time solving the problem. Always check at the source for more information.

http://www.stevensacks.net/2008/12/23/solution-as3-security-error-2122-with-300-redirects/

http://software-troubleshooter.blogspot.com/2010/02/error-2122-security-sandbox-violation.html

http://www.actionscript.org/forums/showthread.php3?t=228659
http://papervision3d.758870.n4.nabble.com/The-unbeatable-Security-sandbox-dilemma-Policy-file-not-working-td2717943.html
http://www.designswan.com/archives/actionscript-30-flashs-security-sandbox.html
http://www.inklink.co.at/blog/?p=14
http://www.onegiantmedia.com/as3—load-a-remote-image-from-any-domain-with-no-security-sandbox-errors

About Judah

Please note in the comments if this has helped you or not.
This entry was posted in Runtime, Security Error. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Highlight your code before posting code:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="">