Apache flex 从另一个域访问swf
当尝试从不同于我的swf域的域加载swf时,出现以下错误:Apache flex 从另一个域访问swf,apache-flex,actionscript-3,flash,external,loading,Apache Flex,Actionscript 3,Flash,External,Loading,当尝试从不同于我的swf域的域加载swf时,出现以下错误: *** Security Sandbox Violation *** SecurityDomain 'file:///C:/Documents and Settings/Welcome/My Documents/Flex Builder 3/SwfLoad/bin-debug/SwfLoad.swf' tried to access incompatible context 'http://example.com/cros
*** Security Sandbox Violation ***
SecurityDomain 'file:///C:/Documents and Settings/Welcome/My Documents/Flex Builder 3/SwfLoad/bin-debug/SwfLoad.swf' tried to access incompatible context
'http://example.com/crossdomain.xml'
loading of class failed. class name is MGroundTileInsideZ1 failure error is SecurityError:
Error #2119: Security sandbox violation: caller file:///C:/Documents and Settings/Welcome/My Documents/Flex Builder 3/SwfLoad/bin-debug/SwfLoad.swf
cannot access LoaderInfo.applicationDomain owned by http://example.com/zoom_assets/GroundTiles.swf.
以下是我的crossdomain.xml:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
尝试从本地web服务器而不是从文件系统执行SWF。 在Flash Builder中,转到项目的属性并选择Flex Build Path。更改输出文件夹和输出文件夹URL,使其与web服务器的文档根目录及其相应的URL相匹配
如果仍然需要从本地文件系统启动SWF,请尝试调整并将本地目录添加到受信任的目录。尝试从本地web服务器而不是从文件系统执行SWF。
context.securityDomain = SecurityDomain.currentDomain;
在Flash Builder中,转到项目的属性并选择Flex Build Path。更改输出文件夹和输出文件夹URL,使其与web服务器的文档根目录及其相应的URL相匹配
如果仍然需要从本地文件系统启动SWF,请尝试调整并将本地目录添加到受信任的目录
context.securityDomain = SecurityDomain.currentDomain;
我也必须包括上面这一行
事实上,我可以取消:
Security.loadPolicyFile("http://mydomain.com/crossdomain.xml");
及
我也必须包括上面这一行
事实上,我可以取消:
Security.loadPolicyFile("http://mydomain.com/crossdomain.xml");
及
我刚刚用Flash Builder 4、SDK 4.1和Flash Player 10.1对它进行了测试,它运行正常。我正在用Flex Builder 3、SDK 3.0和Flash Player 10.1对它进行测试,但不起作用。它只有在我这样做之后才起作用:context.securityDomain=securityDomain.currentDomain;我刚刚用Flash Builder 4、SDK 4.1和Flash Player 10.1对它进行了测试,它运行正常。我正在用Flex Builder 3、SDK 3.0和Flash Player 10.1对它进行测试,但不起作用。它只有在我这样做之后才起作用:context.securityDomain=securityDomain.currentDomain;