Flash的安全沙箱

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

在未经授权的情况下,Flash默认状态是不允许进行跨域通信的,这样就使得Flash的安全可靠性得到了提高

//++++++++++++++++++++++++++++ 没有指定元策略

警告: 域 xxx.xxx.xxx.xxx 没有指定元策略。将应用默认元策略 'master-only'。此配置已停用。请访

问/go/strict_policy_files_cn以解决此问题。

A:策略文件有错误 CrossDomain.xml

PS:加载方式 Security.loadPolicyFile("http://myDomain/crossdomain.xml");

策略文件放在被加载者服务器根目录(在提供数据的站点放入一个crossdomain.xml文件)

个人理解:所有网络上的资源除非是服务器限制,我们都可以加载,只是无法对其进行数据的操作,如果需要操作这些数据,就需要在服务器上放置策略文件。(eg:如果需要对图片进行像素级操作,那就在服务器上放策略文件)

再次PS:如果策略文件不在根目录,需要用 Security.loadPolicyFile(filepath); 方法加载安全策略文件

//++++++++++++++++++++++++++++ 对加载者进行权限操作 (applicationDomain)

SecurityError: Error #2119: 安全沙箱冲突:调用

者http://cs4165.vkontakte.ru/[[IMPORT]]//fish_xn/main.swf?

lang=ru&pid=0&apiID=1716287&mode=0&version=2027 不能访

问/fish_xn/items.swf拥有的 LoaderInfo.applicationDomain。

at flash.display:oaderInfo/get applicationDomain()

at cafe.util::CClass$/getClass()

at cafe.map::CLayerLoading/showCookResLoading()

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at cafe.main::main/getResLoading()

at cafe.main::main/loadCompleteHandler()

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at cafe.load::CLoad/load()

at cafe.load::CLoad/loadStartHandler()

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at cafe.load::CLoad/loaderCompleteHandler3()

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at cafe.load::CLoadAbstract/finish()

at cafe.load::CLoadConfig/loadConfigHandler()

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at ::URLLoader/onComplete()

在被加载者SWF内写入

Security.allowDomain("*");// 注意,"" 和 ""不是相同域,多个域用逗号隔开PS:security.allowDomain ("*") 与跨域加载资源其实是两回事

有security.allowDomain ("*")标注的Flash文件只表示成功加载此的容器可以对它进行所有权限的操作//++++++++++++++++++++++++++++

//为true的时候,先下载策略文件( 指定 Flash Player 在加载对象前是否应检查跨域策略文件是否存在)

var lc oaderContext = new LoaderContext(true);

//var loadercontex oaderContext = new LoaderContext(false, new ApplicationDomain(), SecurityDomain.currentDomain);

var context:LoaderContext = new LoaderContext();

context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);

context.securityDomain = SecurityDomain.currentDomain;

loader.load(url,context);

//++++++++++++++++++++++++++++

解决flash安全沙箱的几种方法总结

1。配置跨域文件来实现

System.security.allowDomain("", "", "");

2。利用JS脚本绕过安全沙箱(有待验证)

3。使用绕过As3的跨域安全沙箱完全的文件转发,以极低的效率来解决了问题,基本无实用价值4。本地安全沙箱:在C:\windows\system32\Macromed\Flash\FlashPlayerTrust 下面,添加一个txt文件,例如songhuan .txt,然后在里面添加你的本机的目录,例如f:\crayon\或者c:\都可以。

相关文档
最新文档