From providing a center point in the point[x1, y1] form and a radius in
pixels, devise a behavior that will detect rollover of the the cursor in
that region. No trig functions need to be used.
on beginSprite
set origin = point( originX, originY )
set boundingRect = rect( originX - radius, originY - radius, originX + radius, originY + radius )
end
on exitFrame me
set mouseLoc = point( the mouseH, the mouseV )
if inside( mouseLoc, boundingRect ) then
-- the mouse is in the ballpark
set z = origin - mouseLoc
set distance = sqrt ( the locH of z * the locH of z + the locV of z * the locV of z )
if distance <= radius then
-- it"s on the circle
-- **DO YOUR THING HERE**
else
-- it"s close, but outside the circle
nothing
end if
end if
end
on getBehaviorDescription
return "Circular Rollover behavior, per Zav"s request."
end