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
SaveScripts Xtra
Opening and closing a CD-door behaviour
AnimCap
Sprite controls
Check For Asset
Prompt for Disk
PRegEx
Slider behaviour v2.2
Sprite Group Movement behavior
Find Drive Movie Is Plating From
 

 

 

Behavior Light Sensitive Text Dropshadow

Added on 8/20/1999

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: MediaMacros (website)

Drop thison a text member and give it an empty sprite channel. You cna assign either a sprite or the mouse as the "light"

--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know. :-)

property spriteNum, shadowSprite, follow, followSPrite, rangeOffset

on getPropertyDescriptionList me
  p_list = [:]
  if the currentSpriteNum > 0 and sprite(the currentSpriteNum).member.type = #text then
    p_list.addProp(#shadowSprite, [#format : #integer, #comment : "Which sprite to use as the shadow?", #default : (the currentSpriteNum + 1)])
    p_list.addProp(#follow, [#format : #symbol, #comment : "What should the shadow follor?", #default : #mouse, #range : [#mouse, #sprite, #nothing]])
    p_list.addProp(#rangeOffset, [#format : #float, #comment : "Offset value for the shadow:", #default : 100.0])
    p_list.addProp(#followSprite, [#format : #integer, #comment : "If following a sprite, which sprite?", #default : the currentSpriteNum + 2])
  end if
  return p_list
end

on beginSprite me
  if sprite(spriteNum).member.type = #text then
    if sprite(shadowSprite).member.type = #empty then
      puppetSprite shadowSprite true
    end if
    sprite(spriteNum).ink = 36
    sprite(shadowSprite).ink = 36
    sprite(shadowSprite).member = sprite(spriteNum).member
    sprite(shadowSprite).forecolor = 255
    sprite(shadowSprite).locz = sprite(spriteNum).locZ - 1
  end if
end

on endSprite me
  puppetSprite shadowSprite false
end

on enterFrame me
  if sprite(spriteNum).member.type = #text then
    if follow = #mouse then
      distance = sprite(spriteNum).loc - point(the mouseH, the mouseV)
      sprite(shadowSprite).loc = sprite(spriteNum).loc + (distance / point(rangeOffset, rangeOffset))
    else if follow = #sprite then
      distance = sprite(spriteNum).loc - sprite(followSprite).loc
      sprite(shadowSprite).loc = sprite(spriteNum).loc + (distance / point(rangeOffset, rangeOffset))
    end if
  end if
end

on getBehaviorDescription me
  return "Drop this behavior on a text member and assign an empty sprite or a sprite with a second instance of the same cast member. Choose the " & quote & "light" & quote & " and you are ready to go."
end

 


Contact

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

Send e-mail