Erik’s Brain

The reward of a thing well done...

Error #2121 When Loading External SWF

I’m running into an issue that goes a little something like this:

  • I have an external SWF that I’m loading into another parent SWF
  • The external SWF is simply a still image I created from a PNG using Fireworks CS3
  • I package up the parent SWF and external SWF and send it to another computer
  • When loading the external SWF with a Loader, I get the following message when trying to access the loader.contentLoaderInfo.content property within the Loader’s Event.INIT listener:
1
2
SecurityError: Error #2121: Security sandbox violation:
LoaderInfo.content: file:///Users/erikhansen/Desktop/SWF Loader Test/swf_loader.swf cannot access file:///Users/erikhansen/Desktop/SWF Loader Test/from_fireworks.swf. This may be worked around by calling Security.allowDomain.

Some more info that I know:

  • This works just fine when posted to a web server
  • This will also work without throwing an error if I create the external SWF with Flash (which will just make the whole process of making SWFs from PNGs even a bigger pain in the ass than it already is)
  • If I want, I could just add the Loader directly to the stage, but there are times that I need access to the loader.contentLoaderInfo.content property

So I’m trying to figure out a way around this problem. It usually isn’t a problem at all since, like I said, it works fine when being loaded from a web server. But it is a problem when I send a project to a client and they can’t view it on their computer. Hmm…

No solution yet. Maybe you know something I don’t.

Comments