I have created a bitmap using an image from the queue. Next, I am trying to change the image by updating the image.src property but it isn't working because it expects a path to the image's location. How can I change the first image to the second one in this scenario. I assume that the transition will be smooth because the images are already loaded.
var queue = new createjs.LoadQueue();
queue.on("complete", loaded);
queue.loadManifest([{
id: "one",
src: "image1.png"
},
{
id: "two",
src: "image2.png"
}
]);
var stage = new createjs.Stage('canvas'),
img1 = queue.getResult("one"),
img2 = queue.getResult("two");
var changingImage = new createjs.Bitmap(img1);
stage.addChild(childImage);
stage.update();
function changeImage() {
changingImage.image.src = img2;
stage.update();
}
Upon calling the function changeImage() the image must change in changingImage.