2011-10-26 200 views
0

我正在从facebook和twitter将配置文件图像加载到Flex应用程序中。根据回答from this question,我正在从重定向的网址加载域策略。不过,现在我看到这个错误:Flex忽略策略文件

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

基于从您的其他问题的代码:

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

您需要设置URLRequesthttp://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); 
+0

再次,你是正确的。谢谢! – swatkins