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 ( pnint