Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Spam and Faoul language filter for shockwave
Attr
Simple Paint application
Relative Links
Case sensitive string comparison
XTinyadoDB xtra
MPEG / ActiveMovie ActiveX control
AppActive
Binary Xtra
ChromeLib
MediaMacros Xtras Mall
 

 

 

Behavior Volume Slider

Added on 7/19/1999

 

Compatibilities:
behavior D7 D8 Mac PC

This item has not yet been rated

Author: RainerÖhman

Drop it on your slider button and select either a sound channel or a sprite channel for your sound.

-- VolumeSlider behavior
-- Rainer Öhman, 1999


property spriteNum
property pSound
property pSoundName
property pVolumeBtnSprite
property pSliderConstraintSprite
property pZeroVolumeLoc
property pFullVolumeLoc
property pBtnLoc


on getPropertyDescriptionList
  
  propList = [:]
  
  addProp propList, #pSound, [¬
          #default: 1, ¬
          #format:  #integer, ¬
          #comment: "Sound channel:"]
  
  addProp propList, #pSoundName, [¬
          #default: "Sound member used as a sprite", ¬
          #format:  #string, ¬
          #comment: "Sound name:"]
  
  addProp propList, #pSliderConstraintSprite, [¬
          #default: 1, ¬
          #format:  #integer, ¬
          #comment: "Slider sprite number:"]
  
  addProp propList, #pVolumeBtnSprite, [¬
          #default: 2, ¬
          #format:  #integer, ¬
          #comment: "Volume button sprite number:"]
  
  return propList
end

on getBehaviorDescription
  description = ¬
"Place the volume button in a channel number higher ¬
then the sprite you wish to function as a constraint ¬
for the button. Then drop this behavior on the button. ¬
Chose either a sound channel or the name of the sound ¬
used in a sprite channel."
  return description
end

-----------------

on beginSprite me
  sprite(pVolumeBtnSprite).constraint = pSliderConstraintSprite
  sprite(pVolumeBtnSprite).moveableSprite = TRUE
  sprite(pSliderConstraintSprite).width = 0
  pFullVolumeLoc = sprite(pSliderConstraintSprite).top
  pZeroVolumeLoc = sprite(pSliderConstraintSprite).bottom
  sprite(pVolumeBtnSprite).locV = pFullVolumeLoc
end

on setVolume me
  range = pZeroVolumeLoc - pFullVolumeLoc
  volIndex = 255.0 / range
  diff = pZeroVolumeLoc - pBtnLoc
  v = diff * volIndex
  
  if pSound then
    set the volume of sound pSound = integer(v)
  end if
  
  if not(pSoundName = "Sound member used as a sprite") then
    member(pSoundName).volume = integer(v)
  end if
end

on exitFrame me
  pBtnLoc = sprite(spriteNum).locV
  setVolume
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