使用EaselJS在透明矩形上单击事件

Mis*_*sha 6 easeljs

是否可以制作透明的直接可点击?我不想填写它看起来像

     shape.graphics.setStrokeStyle(2).beginStroke("#000").rect(0, 0, 100, 100)
Run Code Online (Sandbox Code Playgroud)

Mis*_*sha 13

这是代码我是如何做到的:

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;
Run Code Online (Sandbox Code Playgroud)

  • 更多详细信息:“EaselJS 将根据显示对象的可见、非透明像素计算鼠标在其上的点击。...您可以将任何其他显示对象指定为您的对象的 hitArea...将不可见。” 请参阅 http://createjs.com/tutorials/Mouse%20Interaction/ 上的文档和演示 (2认同)