member(whichCastmember).camera(whichCamera).modelUnderLoc(pointWithinSprite)
3D command; returns a reference to the first model found under a specified point within the rect of a sprite using the referenced camera.
This command returns void if there is no model found under the specified point.
For a list of all of the models found under a specified point, and detailed information about them, see modelsUnderLoc.
pointWithinSprite Required. A point under which the first model is found. The location of pointWithinSprite is relative to the upper left corner of the sprite, in pixels.
The first line in this handler translates the location of the cursor from a point on the Stage to a point within sprite 5. The second line determines the first model under that point. The third line displays the result in the message window.
-- Lingo syntax
on mouseUp
pt = the mouseLoc - point(sprite(5).left, sprite(5).top)
m = sprite(5).camera.modelUnderLoc(pt)
put m
end
// JavaScript syntax
function mouseUp() {
pt = _mouse.mouseLoc - point(sprite(5).left, sprite(5).top);
m = sprite(5).camera.modelUnderLoc(pt);
put(m);
}