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
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA