0

Different images should appear on stage. For this I am trying to create an array and put it in a container but id doesn't work. What am I doing wrong? Thanks

canvas = document.getElementById("testCanvas");
stage = new createjs.Stage(canvas);
var queue = new createjs.LoadQueue(true);
var imagesPic = queue.loadManifest(["image1.png", "image2.png","image3.png","image4.png"]);

var w = canvas.width = window.innerWidth;
var h = canvas.height = window.innerHeight;

container = new createjs.Container();
stage.addChild(container);

captureContainers = [];
captureIndex = 0;

for (var i=0; i<50; i++) {
        container.addChild(imagesPic);  
}

for (i=0; i<100; i++) {
        var captureContainer = new createjs.Container();
        captureContainer.cache(0,0,w,h);
        captureContainers.push(captureContainer);
}
  • 1
    What are you trying to do here? Your imagesPic will be null (loadManifest doesn't return anything), and you are caching a bunch of empty containers. – Lanny Nov 12 '14 at 20:53
  • Thank for answering! I make a game. And now I'm trying to make something like rain of different images. – user2131751 Nov 14 '14 at 07:50
  • There is no reason to cache images, unless you plan on filtering them, or somehow changing them in memory (like combining multiple images into one for performance reasons). Currently your example does nothing, except preload the images. There is no handler though to do anything with those images. – Lanny Nov 14 '14 at 16:20

0 Answers0