6

is it possible to make a transparent rect clickable? I don't want to fill it so it looks like

     shape.graphics.setStrokeStyle(2).beginStroke("#000").rect(0, 0, 100, 100)
Misha
  • 828
  • 10
  • 23

1 Answers1

13

here is the code how I did it:

var shape = new createjs.Shape();    
shape.graphics.setStrokeStyle(2).beginStroke("#000").rect(0, 0, 100, 100);
var hit = new createjs.Shape();
hit.graphics.beginFill("#000").rect(0, 0, 100, 100);
shape.hitArea = hit;
Misha
  • 828
  • 10
  • 23
  • 2
    More details: "EaselJS will calculate mouse hits on a display object based on its visible, non-transparent pixels. ... you can assign any other display object to be the hitArea for your object ... will not be visible." See docs and demo at http://createjs.com/tutorials/Mouse%20Interaction/ – Avatar Sep 25 '17 at 08:20