Security Sandbox Violation in Flex

I’m trying to access an mp3’s id3 tags… I keep getting an error when I run try to load any specific mp3. SecurityError: Error #2122: Security sandbox violation Sound.id3

==========================================

On the start of my application I have a init() function that gets executed on creationComplete. I utilize this function to setup all of my listeners, and request of initial data.

The fix is:

==================

import flash.system.Security; public function init():void{

Security.loadPolicyFile(“http://domainname.com/crossdomain.xml“);

}

I happen to own the domain that I am requesting my mp3’s from, so I also control that crossdomain.xml file, so I want any site to be able to access this domain, so I created my crossdomain.xml file in my web root.

It looks like this:

<?xml version=“1.0”?>

<cross-domain-policy>

<allow-access-from domain=“*” />

</cross-domain-policy>

I tried quite a few different combo’s, I had thought originally that if a crossdomain.xml file existed on the server you were requesting data from that it would automatically be picked up by the flash player… most of the documentation that I found stated this to be the way it worked, but in my situation, it was untrue…

Now I am also aware that by declaring in my crossdomain.xml file “allow-access-from domain=”*”” means that any other domain could access it… but I could restrict that by declaring the file like so:

<?xml version=“1.0”?>

<cross-domain-policy>

<allow-access-from domain=“*.cfwebtools.com” />

</cross-domain-policy>

</code> That would also allow my domain “axel.cfwebtools.com” to access the file.

5 comments on this post.
  1. Tagôre Cauê:

    Thanks!

    Muito obrigado, estava com este problema no trabalho e consegui resolver.
    (Portuguese-BR)

  2. win:

    Thanks!!! I had done everything, but didn’t know where to put the loadPolicyFile.
    It really helped me out!!!

  3. Drew:

    Creating crossdomain.xml in my webroot solved the issue I was having – thanks for this post!

  4. II:

    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

  5. Eşref Atak:

    You must create a crossdomain.xml file. Solution is here: http://www.flexnedir.com/flex-ve-coldfusion-channel-connect-failed/

Leave a comment