A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Change volume of a sound on the timeline via AS3

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    6

    Cow Icon 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

  2. #2
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Yes, check out how to use soundChannel in the flash help file. Let me know if this helps.

  3. #3
    Junior Member
    Join Date
    May 2009
    Posts
    6

    Lightbulb 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?

  4. #4
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    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?

  5. #5
    Junior Member
    Join Date
    May 2009
    Posts
    6
    Quote Originally Posted by jweeks123 View Post
    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.

    Quote Originally Posted by jweeks123 View Post
    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.

    Quote Originally Posted by jweeks123 View Post
    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

  6. #6
    Junior Member
    Join Date
    May 2009
    Posts
    6
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center