AS3 Security SandBox违规

时间:2013-02-25 05:23:05

标签: actionscript-3 security sandbox

尝试从浏览器加载游戏时收到此错误消息:

*** Security Sandbox Violation ***
SecurityDomain 'https://playerio.s3.amazonaws.com/competitions/ega2012/swf/Nhm-JFy6dEyuemmaE59BSQ.swf?AWSAccessKeyId=1Q3ETXSFA8S2F2TSA9R2&Expires=1361787227&Signature=TBCVKQDGlxthLj2YhoumxTxUGOo%3D' tried to access incompatible context 'http://cdn.playerio.com/rts-tvkyczvzk5uwqv8z12rw/Game2build29.swf'
SecurityError: Error #2121: Security sandbox violation: LoaderInfo.content: https://playerio.s3.amazonaws.com/competitions/ega2012/swf/Nhm-JFy6dEyuemmaE59BSQ.swf?AWSAccessKeyId=1Q3ETXSFA8S2F2TSA9R2&Expires=1361787227&Signature=TBCVKQDGlxthLj2YhoumxTxUGOo%3D cannot access http://cdn.playerio.com/rts-tvkyczvzk5uwqv8z12rw/Game2build29.swf. This may be worked around by calling Security.allowDomain.
   at flash.display::LoaderInfo/get content()
   at Loader3_fla::MainTimeline/onCompleteHandler()[Loader3_fla.MainTimeline::frame1:86]

它说你可以使用Security.allowDomain()来解决这个错误,但我不确定允许哪个域!

1 个答案:

答案 0 :(得分:0)

您应该将crossdomain.xml放在项目文件夹中,您可以在其中允许应用程序从中获取数据的所有域或某些特定域。

<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
如果您想允许某些特定域,

适用于所有域:

<allow-access-from domain="www.mysite.com" />
<allow-access-from domain="mysite.com" />