为什么我的Flex as3 crossdomain.xml不工作?

为什么我的Flex as3 crossdomain.xml不工作?,xml,actionscript-3,flash,apache-flex,azure,Xml,Actionscript 3,Flash,Apache Flex,Azure,我花了很多时间试图弄清楚我的crossdomain.xml实现出了什么问题。这里有很多关于他们的问题,我从每个问题都试过了 我正在使用Azure Blob存储来存储我的swf需要访问的图像。此外,我正在使用BulkLoader swc加载这些资产。下面是应用程序尝试从url加载图像之前运行的代码 Security.allowDomain("mydomain.blob.core.windows.net"); Security.allowInsecureDomain("mydomain.blob.c

我花了很多时间试图弄清楚我的crossdomain.xml实现出了什么问题。这里有很多关于他们的问题,我从每个问题都试过了

我正在使用Azure Blob存储来存储我的swf需要访问的图像。此外,我正在使用BulkLoader swc加载这些资产。下面是应用程序尝试从url加载图像之前运行的代码

Security.allowDomain("mydomain.blob.core.windows.net");
Security.allowInsecureDomain("mydomain.blob.core.windows.net");
Security.loadPolicyFile("http://mydomain.blob.core.windows.net/crossdomain.xml");
下面是我尝试过的不同crossdomain.xml配置的示例。我可能已经尝试了20种不同的配置,但似乎没有任何效果

一,


任何帮助都将不胜感激。这个问题快把我逼疯了。提前谢谢。

所以我知道我做错了什么。您需要向bulkLoader发送LoaderContext,就像向普通Loader类发送一样。这是我使用的代码。加载声音文件时,还可以使用SoundLoaderContext

var currentSecurityDomain:SecurityDomain = null;
if (Security.sandboxType == Security.REMOTE)
    currentSecurityDomain = SecurityDomain.currentDomain;

var loaderContext = new LoaderContext(true, ApplicationDomain.currentDomain, currentSecurityDomain);

var currentSecurityDomain:SecurityDomain = null;
if (Security.sandboxType == Security.REMOTE)
    currentSecurityDomain = SecurityDomain.currentDomain;

var soundLoaderContext = new SoundLoaderContext(1000, true);

var currentSecurityDomain:SecurityDomain = null;
if (Security.sandboxType == Security.REMOTE)
    currentSecurityDomain = SecurityDomain.currentDomain;

var loaderContext = new LoaderContext(true, ApplicationDomain.currentDomain, currentSecurityDomain);
var soundLoaderContext = new SoundLoaderContext(1000, true);

var bulkLoader:BulkLoader = new BulkLoader("main");
bulkLoader.add(URL, { context: loaderContext, "id":animationID, maxTries:1, priority:priority});
bulkLoader.add(URL_TO_SOUND, { context: soundLoaderContext, "id":animationID, maxTries:1, priority:priority});
bulkLoader.addEventListener(BulkLoader.COMPLETE, onAllItemsLoaded);
bulkLoader.start();

只是猜测一下,但是您能检查包含这个crossdomain.xml文件的
$root
容器的ACL吗?它应该是
Blob
Public
。是的,$root容器设置为Blob。我可以在浏览器中加载crossdomain.xml。
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <site-control permitted-cross-domain-policies="master-only" />
  <allow-access-from domain="*" secure="false" />
  <allow-http-request-headers-from domain="*" headers="*" secure="false" />
</cross-domain-policy>
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-access-from domain="*"/>
</cross-domain-policy>
*** Security Sandbox Violation ***
SecurityDomain 'http://localhost:81/controller/view' tried to access incompatible
context 'http://mydomain.blob.core.windows.net/crossdomain.xml'
var currentSecurityDomain:SecurityDomain = null;
if (Security.sandboxType == Security.REMOTE)
    currentSecurityDomain = SecurityDomain.currentDomain;

var loaderContext = new LoaderContext(true, ApplicationDomain.currentDomain, currentSecurityDomain);

var currentSecurityDomain:SecurityDomain = null;
if (Security.sandboxType == Security.REMOTE)
    currentSecurityDomain = SecurityDomain.currentDomain;

var soundLoaderContext = new SoundLoaderContext(1000, true);

var currentSecurityDomain:SecurityDomain = null;
if (Security.sandboxType == Security.REMOTE)
    currentSecurityDomain = SecurityDomain.currentDomain;

var loaderContext = new LoaderContext(true, ApplicationDomain.currentDomain, currentSecurityDomain);
var soundLoaderContext = new SoundLoaderContext(1000, true);

var bulkLoader:BulkLoader = new BulkLoader("main");
bulkLoader.add(URL, { context: loaderContext, "id":animationID, maxTries:1, priority:priority});
bulkLoader.add(URL_TO_SOUND, { context: soundLoaderContext, "id":animationID, maxTries:1, priority:priority});
bulkLoader.addEventListener(BulkLoader.COMPLETE, onAllItemsLoaded);
bulkLoader.start();