我正在尝试加载外部 SWF 以便调试它。我不控制 SWF 源,但我控制它所在的域。
这是我的代码:
import flash.system.Security;
Security.allowDomain("*");
var swf = ["http://rcnhca.org.uk/wp-content/plugins/assessment-quiz/quiz.swf", "quiz_content/data.swf"]
var loadListener:Object = new Object();
loadListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
trace(">> loadListener.onLoadComplete()");
trace(">> httpStatus: " + httpStatus);
}
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mcLoader.loadClip(swf[0], mc);
但是,这会返回以下许多错误:
SecurityDomain 'http://rcnhca.org.uk/wp-content/plugins/assessment-quiz/quiz.swf' tried to access incompatible context 'file:///G|/Lifelong%20Learning/Active%20work/Sites/rcnhca/wp%2Dcontent/plugins/assessment%2Dquiz/as2debug.swf'
我已经在我的域的根目录中设置了一个 crossdomain.xml 文件,如下所示:
<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
(在这里看到:http ://rcnhca.org.uk/crossdomain.xml )
奇怪的是,SWF 加载但是当我尝试 Debug -> List variables 或在调试窗格中打开它时,它会使整个程序崩溃。