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)
}

2 Answers 2

0

Maybe check here: LINK

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

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.