I'm trying to add an event listener to the example here: http://www.luxanimals.com/blog/article/combining_easel_box2d
What I'm trying to do is, I changed the Bitmap to
var birdBMP = new createjs.Bitmap("images/bird.png");
birdBMP.x = Math.round(Math.random()*500);
birdBMP.y = -30;
birdBMP.regX = 25; // important to set origin point to center of your bitmap
birdBMP.regY = 25;
birdBMP.snapToPixel = true;
birdBMP.mouseEnabled = true;
stage.addChild(birdBMP);
box2d.createBird(birdBMP);
this. Now I'm trying to bind an event listener to this Bidmap object like this.
birdBMP.addEventListener("mousedown", function(evt){
console.log("clicked");
});
But it doesn't work. I'm using same "demo.js" from that example. The only thing I change is the one above. Changing Bitmap to createjs.Bitmap and then add an eventHandler to the bitmap. Everything else is working fine, just can't add an eventHandler. Anyone have any idea about why this eventHandler isn't working?
Thank you.
Edit: Here is the demo.js from the link on top: http://www.luxanimals.com/tutorials/birds/js/demo.js