0
看起来我是通过本书完成的,但它不起作用。这个代码究竟有什么问题?无法将位图添加到舞台
<!DOCTYPE html>
<html lang="sv-se">
<head>
<script src="https://code.createjs.com/easeljs-0.8.2.min.js"></script>
<script src="https://code.createjs.com/tweenjs-0.6.2.min.js"></script>
<script src="https://code.createjs.com/preloadjs-0.6.2.min.js"></script>
<script src="https://code.createjs.com/soundjs-0.6.2.min.js"></script>
<script type="text/javascript">
function init() {
var stage = new createjs.Stage("stage");
stage.canvas.width = 1200;
stage.canvas.height = 871;
var queue = new createjs.LoadQueue();
queue.on("complete", handleComplete, this);
queue.loadManifest([
{id: "myImage", src:"images/image.jpg"}
]);
function handleComplete() {
var myImage = queue.getResult("myImage");
stage.addChild(myImage);
}
}
</script>
</head>
<body onLoad="init();">
<canvas id="stage"></canvas>
</body>
</html>
我得到的是这样的错误信息:未捕获InvalidStateError:未能执行上“事件目标”“dispatchEvent”:所提供的事件为空。
谢谢!这解决了它! – mcThord