on beginSprite me
me .FindLowerSprite()
END beginSprite
on mouseDown me
if pbPropagateMouseDown = TRUE then
me .TransmitEvent( #mouseDown )
end if
END mouseDown
on mouseUp me
if pbPropagateMouseUp = TRUE then
me .TransmitEvent( #mouseUp )
end if
END mouseUp
on mouseEnter me
if pbPropagateMouseEnter = TRUE then
me .TransmitEvent( #mouseEnter )
end if
END mouseEnter
on mouseLeave me
if pbPropagateMouseLeave = TRUE then
me .TransmitEvent( #mouseLeave )
end if
END mouseLeave
on mouseWithin me
if pbPropagateMouseWithin = TRUE then
me .TransmitEvent( #mouseWithin )
end if
END mouseWithin
on rightMouseDown me
if pbPropagateRightMouseDown = TRUE then
me .TransmitEvent( #rightMouseDown )
end if
END rightMouseDown
on rightMouseUp me
if pbPropagateRightMouseUp = TRUE then
me .TransmitEvent( #rightMouseUp )
end if
END rightMouseUp
on FindLowerSprite me
pnIntersectSprite = 0
if pbAssumeStaticStage = TRUE then
nSprite = me . spriteNum - 1
rMyRect = sprite ( me . spriteNum ). rect
repeat with nTest = nSprite down to 1
rTestRect = sprite (nTest). rect
rIntersect = intersect ( rMyRect, rTestRect )
if rIntersect <> rect ( 0 , 0 , 0 , 0 ) then
pnIntersectSprite = nTest
exit repeat
end if
end repeat
end if
END FindLowerSprite
on TransmitEvent me , yEvent
pMousePoint = the mouseLoc
if pnIntersectSprite <> 0 then
rTestRect = sprite (pnIntersectSprite). rect
if pMousePoint. inside ( rTestRect ) then
if sprite (pnIntersectSprite). visible = TRUE or ( sprite (pnIntersectSprite). visible = FALSE and pbPropagateToInvisibleSprite = TRUE ) then
sendSprite ( pnIntersectSprite, yEvent )
end if
end if
else if pnIntersectSprite = 0 and pbAssumeStaticStage = FALSE then
bFoundIntersect = FALSE
nSprite = me . spriteNum - 1
rMyRect = sprite ( me . spriteNum ). rect
repeat with nTest = nSprite down to 1
rTestRect = sprite (nTest). rect
rIntersect = intersect ( rMyRect, rTestRect )
if rIntersect <> rect ( 0 , 0 , 0 , 0 ) then
bFoundIntersect = TRUE
exit repeat
end if
end repeat
if bFoundIntersect = TRUE then
rTestRect = sprite (nTest). rect
if pMousePoint. inside ( rTestRect ) then
if sprite (nTest). visible = TRUE or ( sprite (nTest). visible = FALSE and pbPropagateToInvisibleSprite = TRUE ) then
sendSprite ( nTest, yEvent )
end if
end if
end if
end if
END TransmitEvent