Q:

Getting Actual Facebook and Twitter Profile Image URLS for Flex Security Policy

I'm trying to display the profile images from both facebook and twitter.  For facebook, the URLs I'm receiving are something like this (not actual urls):
http://graph.facebook.com/965412145/picture

Which is then redirected to the 'actual' url like this:
http://profile.ak.fbcdn.net/hprofile-ak-snc4/370471_9631690_1796253478_r.jpg

I'm also doing this with twitter, with the same issue (redirected url). 
So, when I load the image, it loads fine.  But when I close the container that the image is in, then I get the security sandbox violation. 
I can get this all to work if I add the URL from the 'actual' image url like this:
request = new URLRequest("http://profile.ak.fbcdn.net");
loader = new Loader();
context = new LoaderContext();
context.checkPolicyFile = true;
loader.load(request, context);

However, at run time, I do not actually know what the 'actual' image url is, so I can't hard-code that domain in (nor do I want to). 
Is there a way to get the actual url (from within flex) of the image so that I can add the correct domain to the loadercontext? 
Any ideas are appreciated! 

A:

If I understand correctly, your problem is that you're trying to load an image from a URL that redirects to another source.   You need to know what the redirected URL is, so you can load a policy file that allow manipulation of image bytes. 
If I've understood correctly, you need to detect the redirected URL by listening for the COMPLETE event (or an error event), then reference the LoaderInfo.url property.   This property will reflect the end URL in the event of redirects.   For example, you would have code like this in the listener:
var ldr:LoaderInfo = event.target as LoaderInfo;
var url:String;
try
{
    url = ldr.url;
    // Split off URL base, load policy file, etc here
}
catch (e:Error)
{
    // Unable to detect final URL due to error. 
}

