>hello all
>im working on a project which requires me to control
>the sound by using a slider my basic doubt is should i
>create a slider on my own or is there any xtra that
>allows me to automatically create the slider for the
>sound and whats the lingo that is required to increase
>or decrease the volume of sound when the user drags
>the slider please helpp me with the script
>thanks in advance
>sreedhar
Hi sreedhar!
Is this what you're looking for?
-- VolumeSlider behavior
-- Rainer Ohman, 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
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]