开发者

intersects sprite and get currentTarget

I have create a few sprites consist of various music notes, when the cursor sprite move over to one of the notes, it would blink using intersect开发者_如何学C. I have no idea on how to make the cursor detect which note it overlap. Can anyone provide an example?


Try

getObjectsUnderPoint(stage.mouseX, stage.mouseY);

or

for each (var spr:Sprite in notes) {
  if (spr.hitTestPoint (stage.mouseX, stage.mouseY)) {
     // some code here
  }
}

These documentation pages might help: getObjectsUnderPoint, hitTestPoint

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜