加载个人资料图片从Facebook与ActionScript 3的加载、个人资料、图片、ActionScript

2023-09-08 13:14:12 作者:把话烂在心底

我试图加载从Facebook个人资料图片(朋友的图像)与AS3,但我似乎遇到了一个安全问题。

I'm trying to load profile images (friend images) from Facebook with AS3 but I seem to be running into a security issue.

我目前使用的官方的Adobe Facebook的API 为ActionScript 3,工作正常。但是,我跑我的浏览器应用程序时将遇到和个人资料图片。在Flash IDE中运行时的图像加载的罚款。

I'm currently using the "official" Adobe Facebook API for Actionscript 3 which works fine. However, I seem to be having trouble loading profile images when running my application in a browser. The images load fine when running in the Flash IDE.

图像正在从 https://graph.facebook.com 加载并似乎有在该域的crossdomain.xml策略:

The images are being loaded from https://graph.facebook.com and there seems to be a crossdomain.xml policy on that domain:

<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> 
<cross-domain-policy> 
  <allow-access-from domain="*" secure="false" /> 
 <site-control permitted-cross-domain-policies="master-only" /> 
</cross-domain-policy> 

在其他渠道我发现,在加载图像时应该解决的问题,但这似乎并没有出现这种情况增加了ContextLoader的到我的Loader对象之一:

In other sources I found that adding a ContextLoader to my Loader object when loading the image should solve the problem but this doesn't seem to be the case either:

loader = new Loader();
// add some listeners here...
loader.load( new URLRequest( "imageurl" ), new LoaderContext(true) );

我不太清楚如何进行的时刻。我希望土坯Facebook的API将提供援助,在这一点,但我似乎无法找到任何解决了这个问题。

I'm not quite sure how to proceed at the moment. I was hoping that the Adobe Facebook API would provide assistance in this but I can't seem to find anything that solves this issue.

任何帮助非常AP preciated。

Any help greatly appreciated.

更新:

我刚刚注意到,当我去参观一下我其实重定向到Facebook的CDN在实际图像存储在浏览器中的图像之一。当我硬C中的图像URL以重定向的URL $ C $我可以加载图像中的浏览器。看来,这毕竟不是而是一个重定向的问题是安全问题。

I just noticed that when I visit one of the images in a browser that I'm actually redirected to Facebook's CDN where the actual image is stored. When I hard-code the image url with the redirected URL I can load the image in the browser. It seems that this is not a security issue after all but a redirection issue.

如果这是一个重定向问题,那么这个问题将成为;怎样才可以有Flash播放器加载图像从一个重定向的URL?

If this is a redirection issue then the question would become; How can I have Flash Player load an image from a redirected URL?

更新2:

看来URLRequest类有一个followRedirects财产是只在AIR可用。

It seems that the URLRequest class has a followRedirects property which is only available in AIR.

更新3:

我目前使用的是 PHP脚本让我重定向URL作为变通,但是这当然是远远不够理想和一个潜在的巨大的压力在我的服务器上。

I'm currently using a PHP script to get me the redirected URL as a work around but this of course is far from ideal and potentially a big strain on my server.

推荐答案

我有同样的问题,它看起来像你必须手动加载你的动作重定向到该域的跨域文件。现在,它看起来像所有的Facebook个人资料图片从域 http://profile.ak.fbcdn.net/。

I had the same problem and it looks like you have to manually load the crossdomain file of the domain you are redirected to in actionscript. For now, it looks like all facebook profile images are finally loaded from the domain http://profile.ak.fbcdn.net/.

我只是说这条​​线加载图像之前:

I just added this line before loading the images:

Security.loadPolicyFile("http://profile.ak.fbcdn.net/crossdomain.xml");

这应该允许用于装载重定向图像,只要该重定向域不改变。 ;)

This should allow for loading the redirected images, as long as the redirect domain does not change. ;)