【发布时间】:2012-11-26 01:24:00
【问题描述】:
默认情况下,如果远程服务器未添加策略文件,则无法访问或平滑来自远程域的图像。我记得在另一个项目中,我们能够在这些情况下启用平滑。我们必须将远程域设置或添加到受信任的域阵列。我没有这个代码了,我不记得我们是怎么做到的。有人知道我在说什么以及如何启用它吗?
更多上下文
将此代码添加到您的 Flex 应用程序:
<s:Image id="myImage" source="https://www.google.com/images/srpr/logo3w.png" smooth="true" height="200" width="400" />
并在浏览器中运行它。如果你从 file:// 运行它,它应该会显示平滑的图像。
这是因为 Flash Builder 在开发过程中为其提供了特殊权限。如果你把它放在服务器上,例如http://localhost:8888/Project-debug/Project.html,你会看到它没有被平滑并且控制台中显示错误:
Error: Request for resource at https://www.google.com/images/srpr/logo3w.png by requestor from http://localhost:8888/Project-debug/Project.swf/[[DYNAMIC]]/3 is denied due to lack of policy file permissions.
*** Security Sandbox Violation ***
Connection to https://www.google.com/images/srpr/logo3w.png halted - not permitted from http://localhost:8888/Project-debug/Project.swf
Error: Request for resource at https://www.google.com/images/srpr/logo3w.png by requestor from http://localhost:8888/Project-debug/Project.swf/[[DYNAMIC]]/3 is denied due to lack of policy file permissions.
【问题讨论】:
标签: apache-flex flex4 flex4.5 flex-spark