Reputation:
I'm creating a game in which I want to use an animation using easeljs and a spritesheet. I used the code code below to do this, but the animation doesn't seem to appear on my canvas. This is strange because there are also no errors. What am I doing wrong?
My code:
stage = new createjs.Stage(canvas);
sprite = new createjs.SpriteSheet({
"images": ["./images/vos.png"],
"frames": [[0, 0, 32, 32, 0, 0, 0],
[32, 0, 32, 32, 0, 0, 0],
[64, 0, 32, 32, 0, 0, 0],
[96, 0, 32, 32, 0, 0, 0]],
"animations": {"all": {"frames": [0, 1, 2, 3, 2, 1, 0]}
}
});
vos = new createjs.BitmapAnimation(sprite);
vos.x = 32 + (Math.random() * (canvas.width - 64));
vos.y = 32 + (Math.random() * (canvas.height - 64));
speed=8;
createjs.Ticker.addListener(window);
createjs.Ticker.setFPS(24);
stage.addChild(vos);
vos.gotoAndPlay('all');
Upvotes: 0
Views: 697
Reputation: 1330
You are using the deprecated addListener method, and telling it to look for a tick method on window :
createjs.Ticker.addListener(window);
You should use this instead :
createjs.Ticker.addEventListener("tick", function() {
stage.update();
});
If it does not work, you should take a look here.
Upvotes: 2