Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Filtering - Valentina
Space C
Snap Shot Maker
Windows and Cascading Menus for Shockwave
Volume Behaviour (Buttons)
General Purpose MP3 Parent
SpellCatcher
Vigenere cipher (Encryption)
DirectMedia Xtra 2
simZip Xtra
MediaMacros Xtras Mall
 

 

 

Behavior Sound slider

Added on 8/27/1999

 

Compatibilities:
behavior D7 D8 Mac PC

Rating:

Author: JFCloutier

Drop this behavior on a button. Specify which sprite it should be constrained to, the maximum sound volume, the minimum sound volume and which sound channel(s) it should control. Slider can be vertical or horizontal.

-- Sound slider
-- 8/13/99  JF Cloutier
-- This behavior can certainly be improved, please let me know how!
-- jfcloutier@multivet.com

property mySprite            
property pConstrainer        -- Spritenum to constrain to
property pOrientation        -- Identifies if it's a H or V slider
property pMaxValue           -- Maximum volume of sound value
property pMinValue           -- Maximum volume of sound value
property pConstrainer_min    -- Left or bottom of sprite pConstrainer
property pConstrainer_max    -- Right or top of sprite pConstrainer
property pfactor             -- Incrementation factor along the slider
property pAffectV1           -- Sound channel 1 can be affected or not
property pAffectV2           -- Sound channel 2 can be affected or not
property finger              -- To set a grabbing hand cursor

on beginSprite me
  mySprite = me.spritenum
  
  if pMaxValue <= pMinValue then
    alert "Maximum volume of sound value cannot be equal or less than minimum volume of sound value !"¬
&RETURN&RETURN& "Modify the behavior parameter dialog box accordingly."
    halt
  end if
  
  case pOrientation of
    #horizontal:
      pConstrainer_min = sprite(pConstrainer).left
      pConstrainer_max = sprite(pConstrainer).right
    #vertical:
      pConstrainer_min = sprite(pConstrainer).bottom
      pConstrainer_max = sprite(pConstrainer).top
  end case  
  pfactor = float((pMaxValue-pMinValue)/(pConstrainer_max - pConstrainer_min))
  placeButton
end
--------------------------------------------------------------------------
on placeButton me
  there1 = integer(pConstrainer_min + ((the volume of sound 1) / pfactor))
  there2 = integer(pConstrainer_min + ((the volume of sound 2) / pfactor))
  case pOrientation of
    #horizontal:
      if pAffectV1 then sprite(mySprite).loch = there1
      if pAffectV2 then sprite(mySprite).loch = there2
    #vertical:
      if pAffectV1 then sprite(mySprite).locv = there1
      if pAffectV2 then sprite(mySprite).locv = there2
  end case
end
--------------------------------------------------------------------------
on mouseEnter me
  if finger then cursor 260
end

--------------------------------------------------------------------------
on mouseLeave me
  if finger then
    if the rollover <> mysprite then cursor -1
  end if
end
--------------------------------------------------------------------------
on mouseDown me
  if finger then cursor 290
  case pOrientation of
    #horizontal:
      repeat while the stilldown me
        sprite(mySprite).loch = constrainh(pConstrainer, the mouseh)
        z = abs(integer((pMinValue - (pConstrainer_min - sprite(mySprite).loch) * pfactor)))
        
        if z <= pMaxValue and z >=pMinValue then
          if pAffectV1 then the volume of sound 1 = z
          if pAffectV2 then the volume of sound 2 = z
        end if
        
        updatestage
      end repeat
      
      
    #vertical:
      repeat while the stilldown me
        sprite(mySprite).locv = constrainv(pConstrainer, the mousev)
        z = abs(integer( (pMinValue - (pConstrainer_min - sprite(mySprite).locv)) * pfactor))
        if z <= pMaxValue and z >=pMinValue then
          if pAffectV1 then the volume of sound 1 = z
          if pAffectV2 then the volume of sound 2 = z
        end if
        
        updatestage
      end repeat
  end case
  
  if finger then
    if the rollover <> mySprite then cursor -1
    else cursor 260
  end if
end

--------------------------------------------------------------------------
on getPropertyDescriptionList me
  
  set d = [:]
  addProp d, #pConstrainer, [#default: 0, #format: #integer, #comment: "Slider will be constrained to sprite :"]
  addProp d, #pOrientation, [#default: #horizontal, #format: #string, #range: [#horizontal, #vertical], #comment: "This slider will be "]
  addProp d, #pMaxValue, [#default: 255, #format: #float, #range: [#min: 1, #max: 255], #comment: "Maximum volume of sound value:"]
  addProp d, #pMinValue, [#default: 0, #format: #float, #range: [#min: 0, #max: 254], #comment: "Minimum volume of sound value:"]
  addProp d, #pAffectV1, [ #comment: "Control soundtrack 1 ", #format:  #boolean, #default: TRUE ]
  addProp d, #pAffectV2, [ #comment: "Control soundtrack 2 ", #format:  #boolean, #default: TRUE ]
  addProp d, #finger, [ #comment: "Grabbing hand cursor over this button?", #format:  #boolean, #default: TRUE ]
  return d
end

--------------------------------------------------------------------------
on getBehaviorDescription
  set description = "This is a sound slider behavior. Can be vertical or horizontal. Drop the behavior on the button itself," & RETURN &"then specify which sprite you want the button to be constrained to. "
  return description
end
--------------------------------------------------------------------------
on GetBehaviorTooltip  
  sContent = "This is a sound slider behavior. Can be vertical or horizontal. Drop the behavior on the button itself," & RETURN &"then specify which sprite you want the button to be constrained to. "
  return sContent
end GetBehaviorTooltip

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail