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通訊之類的.

暫時就這樣用下,以後有更好的方法再更新
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章