actionscript回调()函数-URLRequest()导致“安全沙盒冲突”

actionscript回调()函数-URLRequest()导致“安全沙盒冲突”,actionscript,callback,urlrequest,Actionscript,Callback,Urlrequest,*安全沙箱违规* SecurityDomain'http://loadimage.my.com“试图访问不兼容的上下文”http://my.com/My.swf" 我正在actionscript中加载一个jpg图像文件 在回调函数中,我想添加child,但显示了安全沙盒冲突 public function preloadAll() { ... // call preLoad with callback function preLoad(function (slide:Sl

*安全沙箱违规*

SecurityDomain'http://loadimage.my.com“试图访问不兼容的上下文”http://my.com/My.swf"

我正在actionscript中加载一个jpg图像文件

在回调函数中,我想添加child,但显示了安全沙盒冲突

public function preloadAll() {
    ...
    // call preLoad with callback function
    preLoad(function (slide:Slide):void{
        // 
        // loading this url causes the error *** Security Sandbox Violation ***
        //
        var url:String = "http://my.com/My.swf";
        var urlReq:URLRequest = new URLRequest(url); 
        var loader:Loader = new Loader() 
        loader.load(urlReq); 
        slide.image.addChild(loader);
    });
    ...
}


public function preLoad(callback: Function = null) : void {
    this.url = "http://image.my.com/cache/Picture_001.jpg"

    var self:Slide = this;
    this.image.addEventListener(Event.COMPLETE, function() : void {
            // callback when image completes loading
            callback(self);
    });

    this.image.load(this.url);
}    

http://my.com/crossdomain.xml
<?xml version="1.0" ?>
<cross-domain-policy>
  <site-control permitted-cross-domain-policies="master-only"/>
  <allow-access-from domain="*"/>
  <allow-access-from domain="" />
  <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

我不确定您在图像代码中到底想做什么,但我猜您试图访问加载程序的内容,这显然违反了安全性,因为SWF是从不同的域加载的

有两种方法可以访问从不同域加载的SWF的内容:

在当前安全域中加载SWF 在加载的SWF中使用Security.allowDomain 详情如下:

什么是图像类型?e、 幻灯片是幻灯片