Adding a simple image in easeljs

easeljs, html, javascript

Solution

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

» easeljs not showing bitmap

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

- Listen for the onload of the image, and update the stage again

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

Problem

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?

Original source

Related problems