Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  13] [ 7]  / answers: 1 / hits: 19218  / 11 Years ago, tue, december 31, 2013, 12:00:00

This is my htmlcode:



<!DOCTYPE html>
<html>
<head>
<title>test</title>
<script src=http://code.createjs.com/easeljs-0.7.0.min.js></script>
<script src=Doge.js></script>
</head>

<body bgcolor=#C7C7C7 onload=Start();>
<canvas id=DogeCanvas width=480 height=320></canvas>
</body>
</html>


And this is my Doge.js code:



function Start() {
var stage = new createjs.Stage(DogeCanvas);
var doge = new Image();
doge.src = images/doge.jpg
var bitmap = new createjs.Bitmap(doge);
stage.addChild(bitmap);
stage.update();
}


Why it doesn't show anything on the screen?
What is wrong?


More From » html

 Answers
28

The image is not loaded when the stage is updated. I posted an answer here:



» easeljs not showing bitmap




  1. You can add a Ticker to the stage to constantly update it (which most applications do, since there is other things changing over time)

  2. Listen for the onload of the image, and update the stage again

  3. Preload the image with something like PreloadJS before you draw it to the stage.


[#73480] Saturday, December 28, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jadap

Total Points: 101
Total Questions: 104
Total Answers: 98

Location: Mexico
Member since Sun, Jul 25, 2021
3 Years ago
;