0

I am new to create js and I want to show an image in localhost:8000

This is the index.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Movement Test</title>
        <script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>
        <script src="game.js"></script>
    </head>
    <body onload="init()">
        <canvas id="gameCanvas" width="640" height="480" style="display: block; margin: 0 auto;"></canvas>
    </body>
</html>

And this is the game.js

function init() {
    var stage = new createjs.StageGL("gameCanvas")

    var image = new createjs.Bitmap("dababyconvertible.jpg")
    stage.addChild(image)
}
Glow Bunny
  • 102
  • 1
  • 8

2 Answers2

0

Maybe check here: LINK

You should use stage.update() and something else :)

Cecherz
  • 56
  • 1
  • 7
0

As @Cecherz mentioned, you have to ensure you update the stage. However, there is also likely a short delay while the image loads. On localhost it can be a few milliseconds, but in a real environment, it can be much longer.

Check out this answer that provides some good options: easeljs not showing bitmap

Lanny
  • 11,244
  • 1
  • 22
  • 30