Skip to content Skip to sidebar Skip to footer

Kineticjs Event Not Fired For Child Of A Grouped Layer

I am trying to add a click event to an image (Kinetic.Image) I am adding to a KineticJS stage. When I use a simple hierarchy, as shown below (Test 0) the event can be successfully

Solution 1:

I have a feeling you can't group Kinetic.Layer, only Kinetic.Shape. See the wording at this tutorial: http://www.html5canvastutorials.com/kineticjs/html5-canvas-complex-shapes-using-groups-with-kineticjs/

I changed 2 lines in your fiddle and I got it to work:

Replace:

assetLayer.add(element);
group.add(assetLayer);

With:

//assetLayer.add(element);group.add(element);

Voila! The alert fires for 'click' on image.

Post a Comment for "Kineticjs Event Not Fired For Child Of A Grouped Layer"