ITeye博客

flex加载xml文件报安全错误

leiliang · 2009-08-25 11:57 · C · C++ · Flex · Flash · XML · Markdown

初学Flex就碰到安全沙箱问题: *** 安全沙箱冲突 *** 到 data/maps/demo1.xml 的连接已停止 - 不允许从 file:///D:/FlexWorkspace/MapDemo/bin-debug/MapDemo.swf 进行连接 SecurityError: Error #2148: SWF 文件 file:///D:/FlexWorkspace/MapDemo/bin-debug/MapDemo.swf 不能访问本地资源 data/maps/demo1.xml。只有仅限于文件系统的 SWF 文件和可信的本地 SWF 文件可以访问本地资源。 at flash.net::URLStream/load() at flash.net::URLLoader/load() at flash.net::URLLoader() at MapDemo/createHandler() at MapDemo/___MapDemo_Application1_creationComplete() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent() at mx.core::UIComponent/set initialized() at mx.managers::LayoutManager/doPhasedInstantiation() at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/callLaterDispatcher2() at mx.core::UIComponent/callLaterDispatcher()

flex项目上点右键-->properties-->ActionscriptCompiler-->Additional compiler arguments 加上 “ -use-network=false ” 就OK了

swf就无法访问网络资源了,比如socket通讯之类的.

暂时就这样用下,以后有更好的方法再更新

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。