Flex app cannot download images from other servers

牧云@^-^@ 提交于 2019-12-24 07:15:35

问题


in my flex application:

<mx:Image  id="imgItem" source="http://notMySyte.com/1.jpg"/>

when i run my app, I catch this error:

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()

help me please.


回答1:


You need to explicitly allow cross-domain access by creating a crossdomain.xml file in your root folder.

<?xml version="1.0" encoding="utf-8"?>
    <cross-domain-policy>
        <allow-access-from domain="*" />
    </cross-domain-policy>
    ...



回答2:


The site you are loading images from has to explicitly grant Flash/Flex applications by hosting a cross-domain.xml file.




回答3:


You need to have a crossdomain.xml file. After that you need to explicitly load that crossdomain file using the code:

Security.loadPolicyFile("http://foo.com/crossdomain.xml");


来源:https://stackoverflow.com/questions/3850458/flex-app-cannot-download-images-from-other-servers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!