View Full Version : Change volume of a sound on the timeline via AS3
davidonlaptop
May 9th, 2009, 01:34 AM
Hi!
I have several sounds of same length playing on the Timeline, each playing in loop on their own layer so that they can be syncronised on the same tempo (i did not managed to do this through pure AS3).
Is it possible to manipulate the sounds on this timeline individually via actionscript (ie: add listeners, change volume, read position) ?
:link:
-Dave
shoffa
December 11th, 2009, 11:52 AM
Hi!
I have several sounds of same length playing on the Timeline, each playing in loop on their own layer so that they can be syncronised on the same tempo (i did not managed to do this through pure AS3).
Is it possible to manipulate the sounds on this timeline individually via actionscript (ie: add listeners, change volume, read position) ?
:link:
-Dave
Did you ever find a solution to this?
davidonlaptop
December 11th, 2009, 01:35 PM
More or less... we did find a workaround though. Read on :
First, you need to import your files in the library in RAW mode (which is quite heavy) so that your sounds are syncronized when they play.
Secondly, you need to create a movieclip for each of your sound and you put the sound on the timeline.
Third, you put all your sound on the timeline so they all start playing immediatly - that's the only they'll be synronized.
Then since the sounds are all in their own movie clip, you can adjust each mc's volume through Flash10's sound API. Something like mc.soundTransform / soundChannel . setVolume, that's the easy part.
Lastly, if you want to avoid the the 0.25 seconds of cacophonic noise when all the sounds start playing together, you put all these sound MC into a container mc which you load externally via the URL loader. If I remember well, you are allowed to set the container mc's volume to 0 before adding it to the stage.
This allows you to set individual volume of your tracks before unmuting the sound container mc.
Good Luck!:whistle2: That was a lot of fun to figure this out! :be:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.