Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Cursor trails
Outline Text
Dragging and Magnifying a Sprite
Import Save File From Command Line
Set Sound Property of a Flash member
Cutting Puzzle Pieces
cXtraShapeWindow
Amara Flash Photo Slideshow software
Drag To View
Play Backward Until Marker and Jump
MediaMacros Xtras Mall
 

 

 

Behavior Circular Rollover behavior

Added on 6/10/1999

 

Compatibilities:
behavior D6_5 Mac PC

This item has not yet been rated

Author: MichaelSeery

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.

property radius
property origin
property originX
property originY
property boundingRect

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

on getPropertyDescriptionList
  set description = [:]
  addprop description, #radius, [ #default: 10.0, #format:#float, #comment:"radius:"]
  addprop description, #originX, [ #default: 100, #format:#integer, #comment:"x1:"]
  addprop description, #originY, [ #default: 100, #format:#integer, #comment:"y1:"]
  return description
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