I'm having trouble with a cross-domain policy. I'm using the AS3 Loader to fetch an image; I'm making it load the policy file, like this :
var pLoader : Loader = new Loader();
var pContext : LoaderContext = new LoaderContext();
pContext.checkPolicyFile = true;
pLoader.load(new URLRequest(sURL), pContext);
This works fine as long as the image is directly accessible; however, when the server sends a redirect, the loader follows it but loses the checkPolicyFile flag, resulting in a SecurityException - that is, it doesn't check the cross-domain policy of the redirected URL.
I've found a solution here ( http://www.stevensacks.net/2008/12/23/solution-as3-security-error-2122-with-300-redirects ) but looks fragile (that is, looks like it will fail if there's more than one redirect). What would be the correct way of doing this?
EDIT : My currently best solution is to use a new Loader if accessing the content throws a SecurityException AND the loaded URL is different than the one I requested originally... works, but feels like a hack.