Page 1 of 1

a Slider to control volume of mp3 music in livecode

Posted: Fri May 01, 2020 12:55 pm
by Lina
I was wondering is there was a way to control the volume of something with a
slider so that if the slider was one the value 0 there would be no sound, and
if it was on 100, the sounds was as high as it could go

For the script, I tried something like "set the playLoudness of player 1 to
value" Which obviously didn't work, and so yeah, I'm asking for your help..

Re: a Slider to control volume of mp3 music in livecode

Posted: Fri May 01, 2020 1:03 pm
by Klaus
Hi Lina,

welcome to the forum!

Well, almost! :-)
OK, create a slider, set its STARTVALUE to 0 and its ENDVALUE to 100 in the inspector.
Then add this script to the slider:

Code: Select all

on scrollbardrag tValue
   set the playLoudness of player 1 to tValue
end scrollbardrag
The SCROLLBARDRAG message is sent continuously to the scrollbar/slider while dragging and
the paramter tValue is the current value of the slider.

Best

Klaus

P.S.
Personal note:
A little "Hello" or something would not have hurt for the very first posting.

Re: a Slider to control volume of mp3 music in livecode

Posted: Fri May 01, 2020 8:21 pm
by Lina
LOL
Sorry for that
Hi everyone my name is lina
Thank you for your help Klaus

Re: a Slider to control volume of mp3 music in livecode

Posted: Fri May 01, 2020 10:10 pm
by Klaus
You're welcome!