I just begin using EaselJS, and I have some issues with sprites. I want to animate a spritesheet, my code seems right but i still have a white canvas. Could you help me to tell me where I am wrong ?
var img = new Image(),
canvas,
stage,
bmpAnimation;
function init() {
canvas = document.getElementById("myCanvas");
stage = new createjs.Stage(canvas);
img.src = "http://untamed.wild-refuge.net/images/rpgxp/avengers/deadpool.png";
createjs.Ticker.useRAF = true;
createjs.Ticker.setFPS(40);
createjs.Ticker.addEventListener("tick",tick);
}
var spriteSheet = new createjs.SpriteSheet({
images: [img],
frames: {width:32, height:48, regX: 16, regY: 24},
animations: {
walk: [4, 7, "walk"]
}
});
function tick() {
scene.update();
}
bmpAnimation = new createjs.BitmapAnimation(spriteSheet);
bmpAnimation = gotoAndPlay("walk");
bmpAnimation.x = 200;
bmpAnimation.y = 100;
bmpAnimation.currentFrame = 0;
stage.addChild(bmpAnimation);
window.onload = init;
Thank you.