A behavior that ties a logical rect to a sprite and can respond to clicks.
From Cole Tierney"s Code Corner
-- sub rect
-- Cole B. Tierney.
set defaultRectStr = "rect( 0, 0, 0, 0 )"
set s = getAreaSprite()
if NOT voidP( s ) then
if the currentSpriteNum > 0 then
set r = the rect of sprite s - the rect of sprite the currentSpriteNum
set defaultRectStr = string( r )
set description = [:]
addprop description, #offsetRectStr, [#default:defaultRectStr,¬
set str = "Defines a logical rectangle that "sticks" to the sprite it is "
put "attached to and knows when the mouse cursor is over it." after str
put RETURN after str
put " Put a temporary shape rect called "Target Area" " after str
put "on the stage in relation to the main sprite, " after str
put "then drop the this behavior on it (the main sprite). -- CBT; 5/1/98 -- " after str
repeat with i = 1 to 120
set thisMem = the member of sprite i
if the number of member thisMem > 0 then
if the type of member thisMem = #shape then
if the name of member thisMem = "target area" then
set areaSprite = i
on beginSprite me
set rOffset = value( offsetRectStr )
on insideRect me
return inside( point( the mouseH, the mouseV ), rOffset + the rect of sprite spriteNum )
on mouseUp me -- Test method.
if insideRect( me ) then beep
36 South Court Sq
Newnan, GA 30263