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
simFile Xtra
Group of Sprite Mover
rescale
Play/ Pause/ Stop/ Rewind a Flash Sprite
Flash Rotator
Puzzler II - Slider
Tree View
Play/ Pause/ Rewind/ StepForward/ StepBackward Video Sprite
Distance Sensitive Button
Copy and Paste inside editable fields
 

 

 

Behavior Drop Shaddow Button-Alphamania

Added on 6/10/1999

 

Compatibilities:
D6_5 D7 D8 Mac PC Script

Required Xtras:
Alphamania
Effector Set II for Alphamania

This item has not yet been rated

Author: MediaLab (website)

Requires Effector Set 2

property sNum
property shadowHeight
property thirdShadHeight
property moveMode         -- whether in up or down part of animation
property frameCount       -- how much time left in this part of animation
property actionType, actionText -- what to do or where to go
property overMe
property feather
property clickThresh

on getBehaviorDescription me
  return "A simple button behavior that toggles the drop shadow when the user clicks. The sprite moves down and to the right while the drop shadow shrinks. This creates a 'push' effect."
end

on getPropertyDescriptionList me
  set list = [:]
  addProp list, #shadowHeight, [#comment: "Shadow Height:", #format: #integer, #default: 5, #range: [#max: 25, #min:1]]
  addProp list, #feather, [#comment: "Feather:", #format: #integer, #default: 1, #range: [#max: 4, #min:0]]
  addProp list, #actionType, [#comment: "Action Type:", #format: #symbol, #range: [#goToFrame, #doLingo], #default: #doLingo]
  addProp list, #actionText, [#comment: "Frame Name or Handle Name:", #format: #string, #default: "beep()"]
  addProp list, #clickThresh, [#comment: "Click Threshold:", #format: #integer, #default: 1, #range: [#max: 255, #min:0]]
  return list
end

on beginSprite me
  set frameCount = VOID
  set moveMode = VOID
  set overMe = -1
  set thirdShadHeight = shadowHeight / 3
  set sNum = the spriteNum of me
  set the clickthreshold of sprite sNum = clickThresh
  dropShadow(sprite sNum, [#animMode: #static, #xOffSet: shadowHeight, #yOffSet: shadowHeight, feather:feather, transparency:125])
end

on mouseDown me
  set overMe = TRUE
  dropShadow(sprite sNum, [xOffset:thirdShadHeight, yOffset:thirdShadHeight])
  set the locH of sprite sNum = thirdShadHeight + the locH of sprite sNum
  set the locV of sprite sNum = thirdShadHeight + the locV of sprite sNum
  updateStage
end

on mouseWithin me
  if the stillDown and overMe = FALSE then
    -- Now test to see if we are inside our shifted rectangle
    -- so the button doesn't flicker up & down when the mouse is at the edges
    set r = rect(the left of sprite sNum+thirdShadHeight+13, the top of sprite sNum+thirdShadHeight+13,
                 the right of sprite sNum-thirdShadHeight, the bottom of sprite sNum-thirdShadHeight)
    set p = point(the mouseh, the mousev)
    if inside(p,r) then
      dropShadow(sprite sNum, [xOffset:thirdShadHeight, yOffset:thirdShadHeight])
      set the locH of sprite sNum = thirdShadHeight + the locH of sprite sNum
      set the locV of sprite sNum = thirdShadHeight + the locV of sprite sNum
      set overMe = TRUE
    end if
  end if
end


on mouseLeave me
  if the stillDown and overMe = TRUE then
    dropShadow(sprite sNum, [xOffset: shadowHeight, yOffSet: shadowHeight])
    set the locH of sprite sNum = (the locH of sprite sNum) - thirdShadHeight
    set the locV of sprite sNum = (the locV of sprite sNum) - thirdShadHeight
    set overMe = FALSE
  end if
end

on mouseUp me
  if overMe = TRUE then
    dropShadow(sprite sNum, [xOffset: shadowHeight, yOffSet: shadowHeight])
    set the locH of sprite sNum = (the locH of sprite sNum) - thirdShadHeight
    set the locV of sprite sNum = (the locV of sprite sNum) - thirdShadHeight
    set overMe = -1
    
    action(me)
  end if
end

on mouseUpOutside me
  set overMe = -1
end






on action me
  if actionType = #goToFrame then
    -- IF YOU GET A LINGO ERROR HERE, THEN YOU HAVE MIS-ENTERED THE
    -- FRAME NAME OR VALUE
    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
    -- IF YOU GET A LINGO ERROR HERE, THEN YOU HAVE MIS-ENTERED THE
    -- HANDLER FOR THIS BEHAVIOR TO CALL
    do actionText
  end if
end

 


Contact

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

Send e-mail