0

I have to load user's profile image in my flash Facebook app (iframe). But there is something unlikeable with loading it. My loading code is:

var context1:LoaderContext = new LoaderContext();
var req:URLRequest = new URLRequest("http://graph.facebook.com/" + uidvar + "/picture?type=large");

Security.loadPolicyFile("http://graph.facebook.com/crossdomain.xml");
Security.loadPolicyFile("http://profile.ak.fbcdn.net/crossdomain.xml");
Security.allowDomain("*");
Security.allowInsecureDomain("*");

context1.checkPolicyFile = true;
loader.add(req, {id:"profilephoto", context:context1}); // I defined the "loader" as a BulkLoader object before.
loader.start();

But when I debug the swf in Firefox it says

Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: MYSWFURL cannot load data from A FACEBOOK IMG URL

For me, everything is perfect but I'm getting this error. Why?

vimuth
  • 5,064
  • 33
  • 79
  • 116
mhmtemnacr
  • 185
  • 3
  • 18
  • Does your bulkloader add an access token to the url? It is needed for authenticating with Facebook. I recommend you using: http://code.google.com/p/facebook-actionscript-api/ instead of building the api wrapper yourself. – Mircea Jan 12 '13 at 10:38
  • I'm using facebook-actionscript-api. But I don't know whether the BulkLoader is adding an access token or not. – mhmtemnacr Jan 12 '13 at 11:02
  • 1
    If you are using Facebook API you should have the following method called: Facebook.init(Facebook_app_id,callback). It gets an access token and uses it from that point on.Also, you should use Facebook.getImageUrl(url_to_picture,options) to get the url to the image. With the url obtained from calling getImageUrl instead of the "graph.facebook.com" one, you should be able to make your code work – Mircea Jan 12 '13 at 11:20
  • Error is gone but now I'm getting another error, my `loader.getBitmap("profilephoto");` returns null. My new load code is: `loader.add(Facebook.getImageUrl(String(response.id), "large"), {id:"profilephoto"});` – mhmtemnacr Jan 12 '13 at 11:36
  • I suppose you are using bulkloader correctly ie call start() and implement callback. I can only advise to try to use the classic URLLoader instead bulkloader and see if it works. – Mircea Jan 12 '13 at 11:49

0 Answers0