-
Change volume of a sound on the timeline via AS3
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) ?
-Dave
-
Senior Member
Yes, check out how to use soundChannel in the flash help file. Let me know if this helps.
-
Need to control start & stop of timeline sounds
Unless I missed something you can only use the SoundChannel class when creating your sound via AS3 (not via timeline). However playing multiple files simultaneously in AS3 just doesn't work, the sound aren't in sync together.
I fixed the sync problem by putting one sound on the timeline inside a movieclip for each sound. Then I use another movieclip as a container, where i put one instance of each movieclip on the stage. Now all sound are sync and the volume can be changed via mc.soundTransform.
But I can't control yet when the sounds starts to play (immediatly when the movieclip container is finished loaded). I'd like to be able to decide when to start & stop the sounds.
Any idea?
-
Senior Member
So, let me get this straight here. You have all your sounds on the timeline within movieclip holders. Is that correct?
First question is, why? Are you syncing things to that sound?
If, this scenario I'm mentioning is correct then I'd say to put one blank keyframe at the beginning of your movieclip holders. Then put the sound starting on frame 2. That way once they're loaded you can tell them to stop, and when needed, they can go to frame 2. Do you have a source file you can send for example?
-
 Originally Posted by jweeks123
So, let me get this straight here. You have all your sounds on the timeline within movieclip holders. Is that correct?
That's right, plus each mc holder has already a named instance on the stage.
 Originally Posted by jweeks123
First question is, why? Are you syncing things to that sound?
Because it is a DJ mixing console so I need each sound to be playing on the same tempo. I have now only 6 sounds but eventually 36.
 Originally Posted by jweeks123
If, this scenario I'm mentioning is correct then I'd say to put one blank keyframe at the beginning of your movieclip holders. Then put the sound starting on frame 2. That way once they're loaded you can tell them to stop, and when needed, they can go to frame 2. Do you have a source file you can send for example?
That sounds ok, but i forgot to mention that the sounds are playing in loop. By having the frame 1 with no sound would that create gap between the loops?
I've put a demo on my server (4MB).
Thanks Jweeks for your help,
David
-
Just adding a few details on the demo:
The button toggles the sound on/off and the slider controls the volume.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|