0

I try upload image from local file to CreateJS. Code is:

function draw() {
    stage = new createjs.Stage('canvas');
    var img = new Image(),
        f = document.getElementById("uploadimage").files[0],
        url = window.URL || window.webkitURL,
        src = url.createObjectURL(f);
        img.src = src;
    img.onload = function() {
        image = new createjs.Bitmap(this);
        stage.addChild(image);
        stage.update();
        url.revokeObjectURL(src);
    }
}

document.getElementById("uploadimage").addEventListener("change", draw, false);

But after selection file, image don't display at canvas. What is wrong?

Roman Zaykovsky
  • 493
  • 5
  • 12

1 Answers1

0

try to create a bitmap of the image instead of using new Image(); than add this bitmap to the stage, this should work.

CMS
  • 704
  • 3
  • 9
  • 32