flex加载xml文件报安全错误

初学Flex就碰到安全沙箱问题:
*** 安全沙箱冲突 ***
到 data/maps/demo1.xml 的连接已停止 - 不允许从 file:///D:/FlexWorkspace/MapDemo/bin-debug/MapDemo.swf 进行连接
[color=red]
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()[D:\FlexWorkspace\MapDemo\src\MapDemo.mxml:21]
at MapDemo/___MapDemo_Application1_creationComplete()[D:\FlexWorkspace\MapDemo\src\MapDemo.mxml:4]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9308]
at mx.core::UIComponent/set initialized()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:1169]
at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8633]
at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8573]
[/color]

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

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

暂时就这样用下,以后有更好的方法再更新
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值