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
精彩评论