0
*安全沙箱冲突*动作callback()函数 - 的URLRequest()导致 “安全沙箱冲突”
的SecurityDomain 'http://loadimage.my.com' 试图访问不兼容的情况下的“http ://my.com/My.swf'
我正在加载一个jpg图像文件在actionscript中。
在回调函数中,我想要addChild,但会显示“Security Sandbox Violation”。
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>
'image'的类型是什么? (例如'slide'是一个'Slide') – Manish 2012-03-19 19:38:52