2011-03-11 90 views
0

我有一个使用SoundMixer控制音量的较大文件加载的AS3预加载电影。当两个文件位于同一台服务器上时,一切都可以在本地和在线上运行。Flash AS3 SoundMixer沙盒违规?

然而,当我分割文件时,假设有一个服务器上的加载程序swf和另一个上的较大内容,当我单击音量按钮时出现此错误。 (这个错误其实输出,而测试的加载程序SWF文件,加载从在线服务器的内容。)

*安全沙箱冲突* 的SecurityDomain“http://www.onlinedomain.com/content.swf”试图访问不兼容的上下文'文件:///LocalDisc/WORK//loader.swf'

SecurityError:错误#2070:安全沙箱冲突:调用者http://www.onlinedomain.com/content.swf无法访问由file:/// LocalDisc/WORK // loader加载的阶段瑞士法郎。 在flash.media::SoundMixer$/set的SoundTransform() 在content_fla :: MainTimeline/stopSound() 在content_fla :: MainTimeline/soundMenuHandler()

我已经加入的crossdomain.xml文件,以两个服务器允许访问。

该处理的声音在我的content.swf的功能是:

import flash.media.Sound; 
import flash.media.SoundChannel; 
import flash.media.SoundMixer; 


    function soundMenuHandler(event:MouseEvent):void { 

    if (sound == "ON") { 
    sound_btn.gotoAndStop(3); 
    stopSound(); 

    } else { 

    sound_btn.gotoAndStop(1); 
    playSound(); 

    } 
    } 

    function playSound():void { 
    sound = "ON"; 
    SoundMixer.soundTransform = new SoundTransform(1); 

    } 

    function stopSound():void 
    { 
    sound = "OFF"; 
    SoundMixer.soundTransform = new SoundTransform(0); 

    } 

The issue seems to be because of the SoundMixer accessing the loader.swf. Has anyone any idea what is going on and how this can be resolved? 

Many thanks, 

Mark 

回答

0

找到解决方案!

虽然crossdomain.xml策略文件确实包含此域(所以我不知道为什么它不起作用)。我可以通过将此代码添加到加载程序文件来明确授予访问权限。

Security.allowDomain(“www.loadeedomain.com”);

0

文件:///LocalDisc/WORK//loader.swf听起来你是在本地测试。在本地测试,您可以禁用安全检查在Flash安全管理器文件或文件夹:

http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html#117502

+0

感谢您的回复。是的,我仅在本地进行测试才能看到Flash IDE中的输出跟踪。 – crooksy88 2011-03-11 15:44:14

+0

我只是这样做才能看到Flash IDE中的错误输出。问题是,当我在线运行文件时,每个文件都来自不同的服务器,内容文件确实会加载但立即停止工作,因为调用了startSound函数并发生了安全违规。 – crooksy88 2011-03-11 16:21:18

+0

有一个链接,我可以看到发生的错误,并看看crossdomains.xml? – 2011-03-12 14:14:15

0

解决您的嵌入代码,你有跨域问题 另外,还要确保你的crossdomain.xml是达到标准并且是交付

allowscriptaccess = "sameDomain"; 
allownetworking = "all";