Jan Swart
Jan Swart

Reputation: 7221

CreateJS click event on sprite not working

I'm having trouble with a click event on a sprite in CreateJS. The event isn't firing as expected. I've tried:

button.addEventListener("click", function() { alert('test'); });

and

button.on("click", function() { alert('test'); });

Neither of them fire on click event. Any ideas?

Upvotes: 0

Views: 1253

Answers (1)

Jan Swart
Jan Swart

Reputation: 7221

I found my problem. I forgot to enable the mouse on the stage.

e.g.

var stage = new createjs.Stage("canvasId");
//Children of container can dispatch mouse events
stage.mouseChildren = true;
//EaselJS checks 10 times per second what's under mouse pointer
stage.enableMouseOver(10);

CreateJS mouse events tutorial

Upvotes: 0

Related Questions