Html5 canvas 我的非常短的代码没有';我什么也没表现出来

Html5 canvas 我的非常短的代码没有';我什么也没表现出来,html5-canvas,easeljs,Html5 Canvas,Easeljs,在我尝试easeljsjavascript库时,我编写了一个短页面以打印一个蓝色方框。不幸的是,我在Ubuntu12.04主机上用Chromium对它进行了测试:但它没有显示任何内容。此外,Chromium的开发人员控制台未检测到任何错误: index.html <!DOCTYPE html> <html> <head> <title>Drag'n drop sur un carre</title> <script src=

在我尝试easeljsjavascript库时,我编写了一个短页面以打印一个蓝色方框。不幸的是,我在Ubuntu12.04主机上用Chromium对它进行了测试:但它没有显示任何内容。此外,Chromium的开发人员控制台未检测到任何错误:

index.html

<!DOCTYPE html>
<html>   
<head>
<title>Drag'n drop sur un carre</title>
<script src="easeljs-0.5.0.min.js"></script>
<script src="myScript.js"></script>
</head>

<body onload="init()">
<canvas id="mycanvas" width="640" height="480"></canvas>
</body>
</html>
那么:怎么了? 提前谢谢


(我使用的是easeljs 0.5.0)

你需要在最后有stage.update()

function init(){
    stage = new createjs.Stage(document.getElementById("mycanvas"));

    carre = new createjs.Shape();
    carre.graphics.beginFill(createjs.Graphics.getRGB(0, 0, 255));
    carre.graphics.rect(0, 0, 30, 30);
    carre.x = 70;
    carre.y = 50;
    stage.addChild(carre);
}