all groups > flash actionscript > june 2004 >
You're in the

flash actionscript

group:

Sound + and -


Sound + and - OLe
6/30/2004 2:48:47 PM
flash actionscript:
Hello,

I need help for a seemingly simple function:
I have a custom videoplayer which handles a .flv-stream with instance name
"video" and I want a plus and a minus button to control the level of sound
in say steps of 20% increase and decrease respectively.
I have figured out a way to set the sound to a certain level, but am not
able to set it in steps. My current script is as follows:

frame action:
s=new Sound(video)

button action:
on (release)
{
s.setVolume(value);
}

how can this be expanded to be a relative decrease and increase in volume
value?


Re: Sound + and - The Big Giant Head
7/1/2004 1:15:58 AM
Re your volume slider:
You need to create a sound object.
I made an fla for you - it has a slider but you can easliy see
how to make buttons do the work for you. It's here: (728k)
www.big-giant-head.com/downloads/volume.zip

Best wishes
Tony

On 2004-06-30 13:48:47 +0100, "OLe" <ole@ukul.no> said:

[quoted text, click to view]

Re: Sound + and - OLe
7/1/2004 9:43:35 AM
Hello again and thanks for the help I´ve recieved.

The sound object is set in the frame action:
s=new Sound(this)

I somehow (I am not a fluent action scripter!) managed to hack a script that
works for the buttons:

on (release)
{
var g=s.getVolume ();
s.setVolume(g-20);
}

Where the (g-20) is changes to a (g+20) for the plus button. This works! But
the funny thing is that if I click the minus button more than five times
(which gives the g var a negative property) it starts to increase the volume
and the plus button decreases it - when I think about it I reckon that´s
probably just maths isn´t it: two negitves gives a positive value? :-) -.
It also seems that the plus button will increase volume beyond 100% to
levels where only distortion is left - does flash permit levels beyond a
100%?

"The Big Giant Head" <tony@big-giant-head.com> skrev i melding
news:cbvl3t$m02$1@forums.macromedia.com...
[quoted text, click to view]

AddThis Social Bookmark Button