Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Bevel Button-Alphamania
Windows Sounds Scheme Customization
Particle Explosion Effect
Quck Fill
MediaMacros
Scroll Text With Mouse
myBackGround
DirectCommunication
Color Picker MIAWs
goMU-LE (free)
MediaMacros Xtras Mall
 

 

 

Behavior Sub Rect

Added on 7/1/1999

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC

Rating:

Author: ColeTierney

A behavior that ties a logical rect to a sprite and can respond to clicks. From Cole Tierney"s Code Corner http://homepages.together.net/%7Etierney/cole/code/

property offsetRectStr

property spriteNum
property rOffset
--
--   sub rect
--
--      Cole B. Tierney.
--
on getPropertyDescriptionList  
  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 )
    end if    
  end if  
  set description = [:]  
  addprop description, #offsetRectStr, [#default:defaultRectStr,¬
                                 #format:#string,¬
                                 #comment:"offset rect:"]  
  return description  
end

on getBehaviorDescription  
  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  
  return str  
end

on getAreaSprite  
  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
          exit repeat          
        end if
      end if
    end if    
  end repeat
  return areaSprite  
end

on beginSprite me
  set rOffset = value( offsetRectStr )
end

on insideRect me
  return inside( point( the mouseH, the mouseV ), rOffset + the rect of sprite spriteNum )
end

on mouseUp me -- Test method.
  if insideRect( me ) then beep
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail