我在facebook上制作游戏排行榜.我没有使用连接但在画布内工作.当我尝试从Facebook加载图像时,它给出了以下错误.
SecurityError: Error #2122: Security sandbox violation: Loader.content: http://test cannot access http://profile.ak.fbcdn.net/v22941/254/15/q652310588_2173.jpg A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
这是我的加载程序代码
public var preLoader:Loader; preLoader=new Loader(); **update** Security.loadPolicyFile('http://api.facebook.com/crossdomain.xml'); Security.allowDomain('http://profile.ak.fbcdn.net'); Security.allowInsecureDomain('http://profile.ak.fbcdn.net'); **update-end** public function imageContainer(Imagewidth:Number,Imageheight:Number,url:String,path:String) { preLoader=new Loader(); Security.loadPolicyFile("http://api.facebook.com/crossdomain.xml"); var context:LoaderContext = new LoaderContext(); context.checkPolicyFile = true; context.applicationDomain = ApplicationDomain.currentDomain; preLoader.load(new URLRequest(path),context);
有任何想法吗?我正在导入正确的课程.
更新: 我正在加载来自不同域的图像说,调用func http://fahim.com图像来自http://profile.ak.fbcdn.net/v22941/254/15/q652310588_2173.jpg(我有确保图片是静态的,不需要Facebook登录或任何东西,他们只是用户公开个人资料图片)
这是映像策略文件的URL:
Security.loadPolicyFile('https://fbcdn-profile-a.akamaihd.net/crossdomain.xml');
有了这条线,一切都应该工作得很好.