安全沙盒违规 Flash AS3 [英] Security Sandbox Violation Flash AS3

查看:37
本文介绍了安全沙盒违规 Flash AS3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过我的 Flash 项目播放 Youtube 视频.视频播放,但我得到下面的错误,它破坏了我的项目的其余部分.我找不到任何有这个确切错误的地方.我一直试图理解它在告诉我什么,但我就是无法理解它.错误:

I'm trying to play a Youtube video through my flash project. The video plays but I get the error below and it ruins the rest of my project. I couldn't find anywhere that had this exact error. Ive been trying to understand what it's telling me but I just cant wrap my head around it. Error:

*** Security Sandbox Violation ***
SecurityDomain 'http://s.ytimg.com/yts/swfbin/apiplayer3-vflmoXxFm.swf' 
tried to access incompatible context 'file:flashProject.swf'

这是我为播放器准备的代码:

Here's the code I have for the player:

Security.allowDomain("www.youtube.com");

var my_player:Object;

var my_loader:Loader = new Loader();
my_loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
my_loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);

function onLoaderInit(e:Event):void{
addChild(my_loader);
my_player = my_loader.content;
my_player.addEventListener("onReady", onPlayerReady);
} 

function onPlayerReady(e:Event):void{
my_player.setSize(600,300);
my_player.cueVideoById("76BboyrEl48",0);
my_player.x = stage.stageWidth/2 - my_player.width/2;
my_player.y = stage.stageHeight/2 - my_player.height/2;
} 

这是我大学最后一年项目的一部分,所以如果有人有任何想法,我非常乐意尝试一下.在此先感谢:)

This is part of my Final Year college project so if anyone has any ideas Id be more than happy to give it a try. Thanks in advance :)

推荐答案

尝试在您的项目中包含如下所示的 cross-domain.xml 文件.

try including a cross-domain.xml file like the one shown below on your project.

<?xml version="1.0"?>
<cross-domain-policy>
   <site-control permitted-cross-domain-policies="all"/>
   <allow-access-from domain="*"/>
   <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

否则,请尝试在安全设置面板下添加您的内容.http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

Otherwise try adding your content here under the security settings panel. http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

有关安全沙箱的更多信息,请参阅:http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3f.html

for more about security sandbox refer: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3f.html

这篇关于安全沙盒违规 Flash AS3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆