我花了那么多时间试图找出我的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种不同的配置,但似乎没有任何效果。
1.
<?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="all" />
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="*" />
</cross-domain-policy>2.
<?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>3.
<?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'任何帮助都将不胜感激。这个问题把我逼疯了。提前谢谢。
发布于 2014-11-01 01:05:22
所以我想出了我做错了什么。您需要向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();https://stackoverflow.com/questions/26676092
复制相似问题