HTML5 Canvas Listen or Don’t Listen to Events with KineticJS

To listen or don't listen to events with KineticJS, we can set the listening property of the config object to true or false when a shape is instantiated, or we can set the listening property with the setListening() method.  Once we've set the listening property for one or more nodes, we'll also need to redraw the hit graph for each affected layer with the drawHit() method.

Instructions: Mouseover the oval to observe that the event handler is not executed.  Click on "Listen" to start listening for events and observe that the event handler is now executed.

new window

Code Editor

Modified on April 9th, 2013 by Eric Rowell
comments powered by Disqus