2012-12-07 24 views
0

默認情況下,如果遠程服務器未添加策略文件,則無法訪問或平滑來自遠程域的圖像。我記得在另一個項目中,我們能夠在這些情況下實現平滑。我們必須將遠程域設置或添加到受信任的域陣列。我沒有這個代碼了,我不記得我們是如何做到的。有人知道我在說什麼以及如何啓用它嗎?如何將平滑添加到來自外部源的Spark圖像

更多的上下文
將此代碼添加到您的Flex應用程序:

<s:Image id="myImage" source="https://www.google.com/images/srpr/logo3w.png" smooth="true" height="200" width="400" /> 

,並在瀏覽器中運行它。如果你從file://運行它,它應該顯示平滑的圖像。 enter image description here

這是因爲Flash Builder在開發過程中給它特殊的權限。如果你把它的服務器上,例如,http://localhost:8888/Project-debug/Project.html,你會看到它不平滑和錯誤控制檯中顯示:

enter image description here

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. 

回答

0

如果您加載圖像,因爲它應該工作

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

,然後應用

bmp.smooth = true; 

,並然後使用bmp作爲圖像的綁定源。

相關問題