0

默认情况下,如果远程服务器未添加策略文件,则无法访问或平滑来自远程域的图像。我记得在另一个项目中,我们能够在这些情况下启用平滑。我们必须将远程域设置或添加到受信任的域阵列。我没有这个代码了,我不记得我们是怎么做到的。有人知道我在说什么以及如何启用它吗?

更多上下文
将此代码添加到您的 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.
4

1 回答 1

0

如果您将图像加载为

[Bindable]
var bmp : Bitmap = Bitmap( imgLoader.content );

然后申请

bmp.smooth = true;

,然后使用 bmp 作为图像的绑定源。

于 2012-12-08T00:17:35.847 回答