I've been trying to build a game using Crafty.js. I have an image that serves as a button, and once the user clicks on it he will be led to the next page. However, for some reason the mouse click just isn't firing. Any ideas?
Crafty.scene('Main', function () {
Crafty.background("url('images/homeBackground.jpg')");
Crafty.e('2D, DOM, Mouse, next').attr({ //next is the image
x: 600,
y: 600,
w: 100,
h: 50
}).bind('click', function (e) {
alert("Here?"); //this isn't firing
});
});
Event names are case sensitive, you should bind to the Click
event.
More details at: http://craftyjs.com/api/Mouse.html