Groups | Blog | Home
all groups > flash actionscript > february 2007 >

flash actionscript : Volume controller


Flakx
2/25/2007 11:45:02 PM
Right, well basically my volume controller works for each frame, except it
won't remeber what the volume is set at for the next frame,

i've tried:

playsong.setVolume(playsong.getVolume());

Anyone got any ideas on how to sort this?

Thanks
kglad
2/26/2007 12:00:00 AM
there shouldn't be any need to store the volume of playsong when moving from
one frame to another unless you are creating a new sound object in the next
frame (with the same instance name). in that case, store the volume (before
replacing the sound object) in variable.
Flakx
2/26/2007 12:00:00 AM
Pal_w_G
2/26/2007 12:00:00 AM
Before you go to the next frame store the current volume ina var. then in the next frame when the loading completes(sound.onLoad) assign the previously stored volume .

Flakx
2/26/2007 3:22:32 PM
got an example you could show?

because all the variables i try just set the volume to 0, or full and ignore any changes.

kglad
2/26/2007 3:26:05 PM
:



// just before advancing frames:

playsongVol=playsong.getVolume();

// just prior to applying the start() method to your sound in the next frame use:

Flakx
2/26/2007 7:51:44 PM
Hmm, is there a problem because im streaming the music externally that it won't
remeber the volume.
With the code you suggested earlier my code looks like this


but its not working properly any suggestions?

stop();

playsong = new Sound (soundLoader);

// just prior to applying the start() method to your sound in the next frame
use:
playsong.setVolume(trackVolume);

playsong.loadSound("music/track1.mp3?nocache="+new
Date().getTime()+random(999999),true);
playsong.onSoundComplete = function() {

// just before advancing frames:
trackVolume = playsong.getVolume();
nextFrame();
};
kglad
2/26/2007 8:41:43 PM
Pal_w_G
2/27/2007 4:43:31 AM
Try to follow what our good friend kglad had suggested as you are playing only
one sound at a time you need not to create more than one sound object.
Then test your code and tell us whether it is working fine or not. If not then
also give us a detail account of the problem.

Cheers.
Flakx
2/27/2007 3:46:50 PM
yeah.... its called being half asleep the last couple of weeks lol, well ive
condensed all my frames down into one so when one track finishes it loads the
next one. Although this has given me a whole array of new problems but thanks
for the wake up call.


kglad
2/27/2007 3:55:50 PM
Pal_w_G
2/28/2007 4:56:56 AM
We love problems.........they are the essence of developement.......

Any time any prob just post it....... someone will definitely try to help you out...



AddThis Social Bookmark Button