我正在尝试学习使用 PreloadJS 预加载图像。
这就是我所拥有的:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script src="easeljs-0.6.0.min.js"></script>
<script src="preloadjs-0.3.0.min.js"></script>
<script src="soundjs-0.4.0.min.js"></script>
<script>
var stage, output, queue;
function handleComplete() {
var backgroundImage=new createjs.Bitmap("myImg");
stage.addChild(backgroundImage);
stage.update();
}
function init() {
stage = new createjs.Stage("demoCanvas");
queue = new createjs.LoadQueue();
queue.installPlugin(createjs.Sound);
queue.addEventListener("complete", handleComplete);
queue.loadFile({id:"myImg", src:"Background.png"});
}
</script>
</head>
<body onLoad="init();">
<canvas id="demoCanvas" width="1300" height="600">
Your browser does not support canvas
</canvas>
</body>
</html>
当我加载页面时,我收到此错误:
Access is denied: preloadjs-0.3.0.min.js, line 50 character 333
我跟踪了调用堆栈,发现错误是从以下行生成的:
queue.loadFile({id:"myImg", src:"Background.png"});
你能告诉我我哪里出错了吗?