I am trying to learn preloading of images using PreloadJS.
This is what I have:
<!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>
When I load the page, I get this error:
Access is denied: preloadjs-0.3.0.min.js, line 50 character 333
I traced the Call Stack and found out the error is generated from the following line:
queue.loadFile({id:"myImg", src:"Background.png"});
Can you tell me where have I gone wrong?