BTA Flexing

My passion RIAs…………..Shardul Singh Bartwal

SecurityError: Error #2123: Security sandbox violation: LoaderInfo.content.

Posted by Shardul Singh Bartwal on August 4, 2009

If you are using the Loader for loading the images,and you want to play with the bitmap of the image.May be couples fo times an issue can be occur with you. If you will host your application on any machine and your images will be on other machine then you will not able to load the images. And the bad thing is that you will also not find this Error without the debuger version of the flash player,and also it will work perfectly inside your flex builder i.e. development environment. I am assuming here that you have already used the cross domain file. Then to outcome from this problem you will require to add two more lines in the code.

I was written the code earlier like this.

var context: LoaderContext = new LoaderContext()
context.checkPolicyFile = true;
loader.load( new URLRequest( mineUrl ), context )

For out coming to this problem we have to add two more line here.

context.securityDomain = SecurityDomain.currentDomain;
context.applicationDomain = ApplicationDomain.currentDomain;

Hence your overall code will be something like this.

var context: LoaderContext = new LoaderContext()
context.checkPolicyFile = true;
context.securityDomain = SecurityDomain.currentDomain;
context.applicationDomain = ApplicationDomain.currentDomain;
loader.load( new URLRequest( mineUrl ), context )

Please don’t forgot to add the line below which is for adding the crossdomain file.If you have not already added this.

Security.loadPolicyFile( crossDomainPath );

Hope you will like this.

3 Responses to “SecurityError: Error #2123: Security sandbox violation: LoaderInfo.content.”

  1. Gadi said

    So in this case do you use crossdomain.xml on the image’s server or only in you main web server?

  2. Yes,I used the crossdomain on the image’s server.

  3. II said

    If this fix doesn’t work and you just want to get the error to go away, check this out: http://wceii.blogspot.com/2010/03/flash-errorsgo-away-sandbox-security.html

Leave a comment