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
FrameReady()
Impactica
Director 6.5 Stubs
KeyboardControl Xtra Standard
Expert Exchange Forum - Director
Sound Enabled
Set Properties of a Flash Member
ESCAPE Video Studio
Color Cycle-Alphamania
MediaMacros Devcon Presentation 2002 - Imaging Lingo
 

 

 

Behavior Fade In and Out plus other commands

Added on 8/27/1999

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: NeilMadsen

This allows any sprite to fade in and out in at a set rate,
trigger the fade in /out of aother sprites and call other lingo commands

-- Fade In and Out --
-- This causes any given sprite onScreen to fadeIn or fadeOut --
-- By Neil Madsen...nmadsen@tri-mediapro.com -- April 21, 1999 -- updated August 27, 1999 --
-- BrouHaHa Productions copyright 1999 --
-- This behavior is freely distributable as long as these ABOUT lines are kept in tact --
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
property pFadeInOut -- values are #fadeIn or #fadeOut or #stopFade
property pMySprite -- sprite that the script is attached to
property pBlendIncrement -- the amount that the sprite fades in and out by...(1 - 10)
property pCycle -- cycles blending in and out values are #yes or #no
property pInitBlendAmount -- sets the initial opaqueness of the sprite...(0 - 100)
property pMaxBlendAmount -- sets the maximum blend amount for the sprite...How opaque?...(0 - 100)
property pMinBlendAmount -- sets the minimum blend amount for the sprite...How transparent?...(0 - 100)
-- added on Aug.27 1999
property pNextSprite -- the sprite that is supposed to fade in or out next
property pNextSpriteInOrOut -- values are "in" or "out"
property pCallOtherLingo -- allows you to call to other lingo scripts in your movie scripts
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
on beginSprite me
  pMySprite = me.spriteNum
  initFading
end beginSprite
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
on initFading me
  -- sets the ink of the sprite to blend
  -- sets the initial opaqueness value of the sprite
  sprite(pMySprite).ink = 32 -- blend
  sprite(pMySprite).blend = pInitBlendAmount
end initFading
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
-- if the property pCycle is TRUE (1) or FALSE(0) then it performs the
-- proper function to either cycle back and forth or do a one time fade
-- in or out.
on exitFrame me
  if pCycle = 1 then
    cycleFade
  else
    case pFadeInOut of
      #fadeIn:
        sprite(pMySprite).blend = sprite(pMySprite).blend + pBlendIncrement
        if sprite(pMySprite).blend >= pMaxBlendAmount then
          pFadeInOut = #stopFade
          -- added Aug.29/99
          if pNextSprite <> 0 then
            sendSprite(pNextSprite, #setFadeInOutValue, pNextSpriteInOrOut)
          end if
          if pCallOtherLingo <> "" then
            do pCallOtherLingo
          end if
          -- end added Aug.29/99
        end if
      #fadeOut:
        sprite(pMySprite).blend = sprite(pMySprite).blend - pBlendIncrement
        if sprite(pMySprite).blend <= pMinBlendAmount then
          pFadeInOut = #stopFade
          -- added Aug.29/99
          if pNextSprite <> 0 then
            sendSprite(pNextSprite, #setFadeInOutValue, pNextSpriteInOrOut)
          end if
          if pCallOtherLingo <> "" then
            do pCallOtherLingo
          end if
          -- end added Aug.29/99
        end if
    end case
  end if
end exitFrame
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
-- this handler is used to capture a
-- sendSprite(x, #setFadeInOutValue, "in or out") call
-- sent from a button click to begin a fade in or out
on setFadeInOutValue me, inOrOut
  case inOrOut of
    "in": pFadeInout = #fadeIn
    "out": pFadeInOut = #fadeOut
  end case
end setFadeInOutValue
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
-- cycles from the min to max (and back again) blend amounts by the amount
-- specified in pBlendIncrement
on cycleFade me
  case pFadeInOut of
    #fadeIn:
      sprite(pMySprite).blend = sprite(pMySprite).blend + pBlendIncrement
      if sprite(pMySprite).blend >= pMaxBlendAmount then --100 then
        pFadeInOut = #fadeOut
        -- added Aug.29/99
        if pNextSprite <> 0 then
          sendSprite(pNextSprite, #setFadeInOutValue, pNextSpriteInOrOut)
        end if
        if pCallOtherLingo <> "" then
          do pCallOtherLingo
        end if
        -- end added Aug.29/99
      end if
      
    #fadeOut:
      sprite(pMySprite).blend = sprite(pMySprite).blend - pBlendIncrement
      if sprite(pMySprite).blend <= pMinBlendAmount then --0 then
        pFadeInOut = #fadeIn
        -- added Aug.29/99
        if pNextSprite <> 0 then
          sendSprite(pNextSprite, #setFadeInOutValue, pNextSpriteInOrOut)
        end if
        if pCallOtherLingo <> "" then
          do pCallOtherLingo
        end if
        -- end added Aug.29/99
      end if
      
  end case
end cycleFade
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
on getPropertyDescriptionList me
  pdList = [:]
  setaProp pdList,#pFadeInOut,[#default:#fadeIn, #format:#symbol, #comment:"Fade In or Out?", ¬
#range:[#fadeIn, #fadeOut, #stopFade]]
  
  setaProp pdList, #pBlendIncrement, [#comment: "Blend Increment", ¬
    #format: #integer, #default: 5, #range: [#min: 1, #max: 10]]
  
  setaProp pdList, #pCycle, [#comment: "Cycle In and Out?", ¬
    #format: #boolean, #default: 1]
  
  setaProp pdList, #pInitBlendAmount, [#comment: "Blend Amount (How Opaque Is It?)", ¬
    #format: #integer, #default: 0, #range: [#min: 0, #max: 100]]
  
  setaProp pdList, #pMaxBlendAmount, [#comment: "Maximum Blend Amount (How Opaque Can It Get?)", ¬
    #format: #integer, #default: 100, #range: [#min: 0, #max: 100]]
  
  setaProp pdList, #pMinBlendAmount, [#comment: "Minimum Blend Amount (How Transparent Can It Get?)", ¬
    #format: #integer, #default: 0, #range: [#min: 0, #max: 100]]
  
  -- Next sprite to fade in or out property's
  setaProp pdList, #pNextSprite, [#comment: "Fade which sprite next", ¬
    #format: #integer, #default: 0, #range: [#min: 0, #max: 500]]
  
  setaProp pdList,#pNextSpriteInOrOut,[#default:"in", #format:#string, #comment:"Next sprite is to Fade In or Out?", ¬
#range:["in", "out"]]
  
  setaProp pdList,#pCallOtherLingo,[#default:"", #format:#string, #comment:"Any other calls you want to make?"]
  
  return pdList
end getPropertyDescriptionList

on getBehaviorDescription me
  gbDesc = "This allows any sprite to fade in and out in at a set rate, trigger the fade in /out of aother sprites and call other lingo commands."
  return gbDesc
end getBehaviorDescription

on getBehaviorTooltip me
  gbToolTip = "This allows any sprite to fade in and out in at a set rate, trigger the fade in /out of aother sprites and call other lingo commands."
  return gbToolTip
end getBehaviorTooltip
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------

 


Contact

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

Send e-mail