Updated Solution: AS3 Security Error #2122 with 300 Redirects

Quite a while ago Steven Sacks posted a solution to 300 redirects when loading images in Flash.
This seemed to work most of the time but the solution does not work every time (at least anymore).
One thing I noticed with Facebook in particular is that the contentLoaderInfo.url (the redirected url) was not a complete url with profile images. So loading that url would not work.

Started looking into other possible solutions and low-and-behold, the language reference actually tells you what to do.
At the bottom of the checkPolicyFile section, Adobe mentions steps to take with redirects:

  1. Examine the value of LoaderInfo.url after you have received a ProgressEvent.PROGRESS or Event.COMPLETE event, which tells you the object’s final URL.
  2. Call the Security.loadPolicyFile() method with a policy file URL based on the object’s final URL.
  3. Poll the value of LoaderInfo.childAllowsParent until it becomes true.

I put together some example source code below to walk you through the steps.

Hopefully that helps you out!

About the author


View all posts


Leave a Reply

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