Flex忽略策略文件

时间:2011-10-26 14:23:26

标签: facebook actionscript-3 flex twitter

我正在将来自facebook和twitter的个人资料图片加载到flex应用程序中。根据答案from this question,我正在从重定向网址加载域策略。但是,现在我看到了这个错误:

Error: [strict] Ignoring policy file at http://profile.ak.fbcdn.net/ due 
to missing Content-Type.  See http://www.adobe.com/go/strict_policy_files 
to fix this problem.

该URL的crossdomain.xml文件如下所示:

<cross-domain-policy>
    <allow-access-from domain="*" secure="false" to-ports="*"/>
    <site-control permitted-cross-domain-policies="master-only"/>
</cross-domain-policy>

错误表明缺少Content-Type。我该如何解决这个问题?显然,我无法更新facebook的文件。

感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

根据您的其他问题的代码:

request = new URLRequest("http://profile.ak.fbcdn.net");
loader = new Loader();
context = new LoaderContext();
context.checkPolicyFile = true;
loader.load(request, context);

您需要将URLRequest设置为从http://profile.ak.fbcdn.net/crossdomain.xml而不是http://profile.ak.fbcdn.net加载。如果您检查后一个请求返回的标头(确实应该失败),它不会发送任何Content-type标头。但是,http://profile.ak.fbcdn.net/crossdomain.xml文件会发送正确的Content-type: text/xml标头。

所以,你应该使用:

request = new URLRequest("http://profile.ak.fbcdn.net/crossdomain.xml");
loader = new Loader();
context = new LoaderContext();
context.checkPolicyFile = true;
loader.load(request, context);
相关问题