在我的flex应用程序中:
<mx:Image id="imgItem" source="http://notMySyte.com/1.jpg"/>
当我运行我的应用程序时,我发现了这个错误:
SecurityError: Error #2123: Security sandbox violation: Loader.content: http://mySite.com/2/BusFlex/BusProducts.swf/[[DYNAMIC]]/2 cannot access http://cs9621.notMySite.com/u7397474/c_b51d9fe6.jpg. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
at flash.display::Loader/get content()
at mx.controls::SWFLoader/get content()
at mx.controls::SWFLoader/doSmoothBitmapContent()
at mx.controls::SWFLoader/updateDisplayList()
at mx.controls::Image/updateDisplayList()
at mx.core::UIComponent/validateDisplayList()
at mx.managers::LayoutManager/validateDisplayList()
at mx.managers::LayoutManager/doPhasedInstantiation()
at mx.managers::LayoutManager/doPhasedInstantiationCallback()
请帮助我。
答案 0 :(得分:2)
您需要通过在根文件夹中创建crossdomain.xml文件来明确允许跨域访问。
<?xml version="1.0" encoding="utf-8"?>
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
...
答案 1 :(得分:1)
从加载图片的网站必须通过托管跨域文件来明确授予Flash / Flex应用程序。
答案 2 :(得分:1)
您需要有一个crossdomain.xml文件。之后,您需要使用以下代码显式加载该跨域文件:
Security.loadPolicyFile("http://foo.com/crossdomain.xml");