Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Cursors
DOMAJ Site and Forum
cXtraEditBox
Check for VideoforWindows
base64 encode/decode
Countdown Timer
Swap Language Cast Libraries
Director 8.5 Studio
Roil-Alphamania
Show Me Movies
MediaMacros Xtras Mall
 

 

 

Behavior ROLLOVER FADES

Added on 7/8/1999

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: KendallAnderson (website)

Apply to a sprite and set the beginning and ending opacity and the duration for the blend (in frames). On a rollover the sprite will fade from the beginning to the ending opacity. On a mouseleave it will fade back to the beginning opacity.

-- ROLLOVER FADES
-- Kendall Anderson, kpander@home.com, http://members.home.com/kpander

-- may 21 / 99: kendall anderson, initial coding
-- jul 07 / 99: kendall anderson, revised to use blendlevel property

-- apply to an image and set the initial and final blend values
-- also set the length of time (frames) it should take to
-- achieve the final blend
-- mouseenter and mouseleave toggle the blending

property pBegin    -- beginning blend value
property pEnd      -- ending blend value
property pDur      -- how many frames should it take for the full effect
property pCount    -- keep track of how long we are taking
property pMode     -- #none, #on, #off
property Spritenum

on beginsprite me  
  -- convert fade values to value between 0 and 255
  -- (for using the blendlevel property)
  pBegin = float(pBegin) / 100 * 255
  pEnd = float(pEnd) / 100 * 255  
  pMode = #none    -- on init, we aren"t fading anything
  pCount = 0
  pDur = pDur + 1  
  add the actorlist, me  
end

on endsprite me  
  deleteone the actorlist, me  
end

on mouseenter me  
  pCount = 1
  pMode = #on  
end

on mouseleave me  
  pCount = 1
  pMode = #off  
end

on getBehaviorDescription  
  dMsg = ""
  dMsg = dMsg & "Apply to a sprite and set the initial and ending opacity value." & RETURN
  dMsg = dMsg & "On a rollover the sprite will change opacity to the ending value." & RETURN
  dMsg = dMsg & "On a mouseleave the sprite will return to the beginning opacity."  
  return dMsg  
end

on getPropertyDescriptionList  
  pList = [:]  
  addProp pList, #pBegin, [ #comment: "Beginning fade value (0-100%): ", #format: #integer, #default: 0 ]
  addProp pList, #pEnd, [ #comment: "End fade value (0-100%): ", #format: #integer, #default: 100 ]
  addProp pList, #pDur, [ #comment: "Duration (Frames):", #format: #integer, #default: 10 ]  
  return pList  
end

on stepframe me  
  if pMode = #none then exit  
  if pMode = #on then  -- fade on stage    
    if pCount < pDur then
      dBlend = float(pCount)/pDur * pEnd
      sprite(Spritenum).blendlevel = dBlend
      pCount = pCount + 1      
    else
      if sprite(Spritenum).blendlevel <> pEnd then
        sprite(Spritenum).blendlevel = pEnd
        pCount = pCount + 1
      end if      
    end if    
  else if pMode = #off then -- fade OFF stage      
    if pCount < pDur then
      dBlend = 255 - float(pCount)/pDur * pEnd     -- 255 is maximum blendlevel value
      sprite(Spritenum).blendlevel = dBlend
      pCount = pCount + 1      
    end if        
  end if  
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