Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Attrib Xtra
Installed Fonts
Sprite Group Movement behavior
Rollover Swirl-Alphamania
Popup Text List Menu
simPPTEdit 1.0 Xtra
Number of Days in a Month
Magnify-Alphamania
Color Dialog behavior
Sharp Image Export Xtra
 

 

 

Behavior Ripple Button-Alphamania

Added on 6/10/1999

 

Compatibilities:
D6_5 D7 D8 Mac PC Script

Required Xtras:
Alphamania
Effector Set I for Alphamania

This item has not yet been rated

Author: MediaLab (website)

Requires Effector Set 2

property sNum
property height
property actionType, actionText -- what to do or where to go
property overMe
property delay
property mode

on getBehaviorDescription me
  return "A simple button behavior that places a ripple in the sprite when the user clicks."
end

on getPropertyDescriptionList me
  set list = [:]
  addProp list, #mode, [#comment: "Ripple From:", #format: #symbol, #range: [#mouse, #center], #default: #center]
--  addProp list, #height, [#comment: "Height:", #format: #integer, #default: 400, #range: [#max: 2000, #min:1]]
  addProp list, #delay, [#comment: "Delay Frames:", #format: #integer, #default: 15, #range: [#max: 120, #min:1]]
  addProp list, #actionType, [#comment: "Action Type:", #format: #symbol, #range: [#goToFrame, #doLingo], #default: #doLingo]
  addProp list, #actionText, [#comment: "Action Text:", #format: #string, #default: "beep()"]
  return list
end

on beginSprite me
  set overMe = -1
  set sNum = the spriteNum of me
  set frameCount = VOID
  ripple(sprite sNum)
  PauseEffect(sprite sNum, #ripple)
end

on mouseDown me
  set overMe = TRUE
  if mode = #center then
    set x = (the width of sprite sNum)/2
    set y = (the height of sprite sNum)/2
  else
    set x = the mouseH - the left of sprite sNum
    set y = the mouseV - the top of sprite sNum
  end if
  ripple(sprite sNum, [#xLocation: x, #yLocation: y])
end

on mouseEnter me
  if the stillDown and overMe = FALSE then
    if mode = #center then
      set x = (the width of sprite sNum)/2
      set y = (the height of sprite sNum)/2
    else
      set x = the mouseH - the left of sprite sNum
      set y = the mouseV - the top of sprite sNum
    end if
    ContinueEffect(sprite sNum, #ripple)
    ripple(sprite sNum, [#xLocation: x, #yLocation: y])
    set overMe = TRUE
  end if
end

on mouseWithin me
  if mode <> #center and the stillDown and overMe = TRUE then
    set x = the mouseH - the left of sprite sNum
    set y = the mouseV - the top of sprite sNum
    ripple(sprite sNum, [#xLocation: x, #yLocation: y])
  end if
end

on mouseLeave me
  if the stillDown and overMe = TRUE then
    PauseEffect(sprite sNum, #ripple)
    set overMe = FALSE
  end if
end

on mouseUp me
  if overMe then
    set overme = -1
    repeat with x = 1 to delay
      updateStage
    end repeat
    
    Removeeffect(sprite sNum, #ripple)
    ripple(sprite sNum)
    PauseEffect(sprite sNum, #ripple)
    
    action(me)
  end if
end

on mouseUpOutside me
  Removeeffect(sprite sNum, #ripple)
  ripple(sprite sNum)
  PauseEffect(sprite sNum, #ripple)
  
  set overMe = -1
end

on action me
  if actionType = #goToFrame then
    if value(actionText) > 0 then
      go to frame value(actionText) -- go to frame number
    else
      go to frame actionText -- go to frame label
    end if
  else if actionType = #doLingo then
    do actionText
  end if
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail