zoukankan      html  css  js  c++  java
  • swf不能访问本地资源的解决办法

    对于类似的出错信息:
    SecurityError: Error #2148: SWF 文件 file:///F:/work2010/tiger/rmpublisher.air/bin-debug/index.swf 不能访问本地资源 file:///F:/work2010/tiger/rmpublisher.air/bin-debug/plugins/plugins.xml。 只有仅限于文件系统的 SWF 文件和可信的本地 SWF 文件可以访问本地资源。
    at flash.net::URLStream/load()
    at flash.net::URLLoader/load()
    at com.edlt.utils::Settings/loadSettings()
    解决方法:

    第一种:

    flex项目上点右键-->properties-->ActionscriptCompiler-->Additional compiler arguments
    加上“ -use-network=false ”,这种方式swf就无法访问网络资源了,比如socket通讯之类的。所以最好不要这样用。

    第二种:

        找到windows安装目录下system32\Macromed\Flash\FlashPlayerTrust,在这个目录下随便建个文本文件,在文件里输入需要访问本地资源flash的详细路径,保存。执行swf,不再出错了。OK

    如: 在C:\WINDOWS\system32\Macromed\Flash\FlashPlayerTrust目录下添加一个文件,比如:1.txt(文 件名可任意起),文件内容为:“D:\demo\test\”即项目的路径,当然也可以设置为“D:\”。需要关闭浏览器这种设置才会生效,因为如果浏览 器正在运行,Flash player 已经读取了FlashPlayerTrust的内容,新的设置不会生效。参考http://kb2.adobe.com/cps/518 /cpsid_51814.html。

    第三种:
    如果让一个swf可被其他域访问,使用 flash.system.Security.allowDomain(),flash.system.Security.allowInsecureDomain()。参数设置为“*”可以让所有的域能够访问它。

    第四种:
    使用策略文件:内容可以是ip,域名,*。
    <?xml version="1.0"?>
    <!-- http://www.mydomain.com/crossdomain.xml -->
    <cross-domain-policy>
    <allow-access-from domain="www.otherdomain.com" />
    <allow-access-from domain="*.adobe.com" />
    <allow-access-from domain="123.45.67.89" />
    <allow-access-from domain="*" />
    </cross-domain-policy>
    再使用 flash.system.Security.loadPolicyFile() 读取这个策略文件。这种方式是最灵活,最安全的方式。
  • 相关阅读:
    Java基础面试题总结-编程题总结
    Linux下mysql的安装与卸载并且连接navicat详解(亲测可用)
    linux 下安装redis
    linux 下安装tomcat
    Linux系统下安装jdk及环境配置(两种方法)
    Servlet概述
    多线程之volatile关键字
    多线程之ThreadLocal
    多线程之synchronized实现原理
    线程池2
  • 原文地址:https://www.cnblogs.com/chenhaib/p/2106305.html
Copyright © 2011-2022 走看看