【问题标题】:SecurityDomain 'http://domain.com/app/widget/twitter.png' tried to access incompatible context 'app:/App.swf'SecurityDomain 'http://domain.com/app/widget/twitter.png' 试图访问不兼容的上下文 'app:/App.swf'
【发布时间】:2012-02-19 12:10:19
【问题描述】:

我正在尝试将远程图像加载到我的 AIR 应用程序中,但出现以下错误:

*** Security Sandbox Violation ***
SecurityDomain 'http://[------].com/app/widget/twitter.png' tried to access incompatible context 'app:/App.swf'

*域名已编辑

所以基本上是说远程图像正在尝试访问应用程序?如何将远程域添加为受信任?

我尝试了Security.allowDomain('www.[------].com') 并得到以下错误:

SecurityError: Error #3207: Application-sandbox content cannot access this feature.
at flash.system::Security$/allowDomain()

【问题讨论】:

    标签: apache-flex security air crossdomain.xml


    【解决方案1】:

    您是否有权访问远程域以将 crossdomain.xml 文件放在 Web 服务器的根目录中?

    如果没有,您可以通过将图像加载为字节数组(请参阅 URLLoader)然后将其转换为内存中的图像(请参阅 SWFLoader.loadBytes)来解决沙盒问题。

    【讨论】:

    • 我确实有访问权限。但这不是需要相当于 crossdomain.xml 的应用程序吗?
    • Flash 安全沙箱有很多陷阱,我必须承认我不是 100% 了解 AIR 沙箱(这往往更严格一些)。 TBH 我只是试一试,看看它是否有效。如果它不起作用,我会按照我在回答中提到的那样做,并将文件加载为字节数组。
    • 里奇是对的。需要跨域的不是应用程序,而是您的应用程序尝试从中下载内容的域。您需要将跨域放在域的顶层。
    猜你喜欢
    • 1970-01-01
    • 2011-02-20
    • 1970-01-01
    • 1970-01-01
    • 2015-03-14
    • 2020-02-20
    • 1970-01-01
    • 1970-01-01
    • 2018-06-28
    相关资源
    最近更新 更多