dc2000
11-06-2008, 01:53 AM
Hi everyone:
I have the following code to play a lengthy mp3 file (that is imported in the library as is linked as CTestSound class):
var st:SoundTransform = new SoundTransform();
var snd:CTestSound = new CTestSound();
snd.play(0, 0, st);Then I have a volume slider on the stage that sends SliderEvent.CHANGE event that should control the volume of the playback:
function onSliderChange(evt:SliderEvent):void
{
st.volume = Number(evt.value - evt.target.minimum) / Number(evt.target.maximum - evt.target.minimum);
}But nothing happens with the sound.
Can someone tell me how to control the volume of a sound that is already playing?
I have the following code to play a lengthy mp3 file (that is imported in the library as is linked as CTestSound class):
var st:SoundTransform = new SoundTransform();
var snd:CTestSound = new CTestSound();
snd.play(0, 0, st);Then I have a volume slider on the stage that sends SliderEvent.CHANGE event that should control the volume of the playback:
function onSliderChange(evt:SliderEvent):void
{
st.volume = Number(evt.value - evt.target.minimum) / Number(evt.target.maximum - evt.target.minimum);
}But nothing happens with the sound.
Can someone tell me how to control the volume of a sound that is already playing?