Question
Add Imported Image to MovieClip and Run Function After Load
I found this solution for importing an image, then attaching it to a movieclip:
var image = new createjs.Bitmap("Assets/svg/04a_MultiPurpose_Solution-exported.svg");
this.MainBlueprint.Blueprint.addChild(image);
I then wanted to obtain the width and height after the image was loaded. All I found was this:
var img = new Image();
img.onload = function() {
// gets called when the img is loaded
alert(img.width+" "+img.height);
};
img.src='Assets/svg/04a_MultiPurpose_Solution-exported.svg';
Problem now is that when I try this in the code:
this.MainBlueprint.Blueprint.addChild(img);
it does not work. Does anyone know the solution to this? Thanks.
