我们正在构建一个可从Facebook上加载用户照片的应用程序。看起来,Facebook在多个主机上托管这些图像。在发生安全沙箱冲突后,是否可以动态添加跨域策略?Flash/Facebook - 动态添加跨域策略到SWF?
例如...
try
{
// Load the photo passed from the js method
}
catch (SecuritySandboxViolation Exception:e)
{
/*
Transform the exception message which contains the host url from...
"security error: Error #2048: Security sandbox violation: http://canvas-app.domain.com/SWF.swf cannot load data from security error: Error #2048: Security sandbox violation: http://facebook.tombstone.com/halloween-party-kit/GI_2011_09_TOMBSTONE_SPOOKIFY.swf cannot load data from https://s-hphotos-sjc1.fbcdn.net/229411_989116685126_5519474_47232933_4376850_n.jpg.22421_989116685126_5519474_47232933_4376850_n.jpg."
to...
https://s-hphotos-sjc1.fbcdn.net
*/
var host = e.getMessage();
// *magical string transformation*
Security.loadPolicyFile(host)
}
如果您试图通过多个域加载和执行额外的swfs,那么您只需要一个跨域策略。 – 2011-09-21 01:37:16
@Jacob:我们需要对图像执行像素操作。这要求我们使用受跨域策略影响的加载方法。是否有可能动态加载跨域文件? –
@John也许你可以用更多的细节来更新你的问题,因为如果你只是需要一个跨域策略文件来加载图片,那么存在一些严重错误。你不应该要求一个。你应该能够使用URLLoader加载Loader对象或原始二进制数据,属性设置为URLLoaderDataFormat.BINARY(我相信类似的东西,我实际上并没有在几个月内写入任何as3。) – 2011-09-21 14:48:07