dcsimg
A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 29 of 29

Thread: [Resolved] fading sound

  1. #21
    I already tried to apply the sound object method to the background sound I need to fade and used the embedded sound approach to the vocals, but the embedded sound still fades out together with the background sound.

    is there any way i can set the embedded sound to a variable?

    thanks!

  2. #22
    I already tried to apply the sound object method to the background sound I need to fade and used the embedded sound approach to the vocals, but the embedded sound still fades out together with the background sound.

    is there any way i can set the embedded sound to a variable and at the same time it will synchronize with the animation on the main timelime?

    thanks!

  3. #23
    Junior Member
    Join Date
    Dec 2001
    Posts
    5
    The info on actionscipting sounds VERY helpful, but I'm stuck on one small thing:

    I've got a movie 7 frames long and the second frame has this code on it:

    stop();
    song = new Sound();
    // new sound object
    song.attachSound("SPURTLE");
    // sound in the library exported to actionScript with name music
    song.start(0,999);
    // get the groove going (play the sound)
    function fadeSound() {
    if (song.getVolume()>0) {
    song.setVolume(song.getVolume()-10);
    trace(song.getVolume());
    // see values in output window
    } else {
    clearInterval(counter);
    }
    }

    ++++++++++++++++++++++
    then later in my movie, I've got a hidden, blank MC that says this:

    onClipEvent (load) {
    counter = setInterval(_root.fadeSound, 300);
    }

    ++++++++++++++++++++++

    Of course, this fades SPURTLE out in three seconds - perfect. After a bit, I've set the movie to loop, but this time I can't get any sound to play at all, including all event sounds placed in various frames, as if the "master volume" has been switched off. I've tried adding the following code after the timer event that triggers the loop, but nothing changes:

    stop();
    function clearInterval(counter) {
    }
    song.start(0,999);
    // get the groove going (play the sound)
    function fadeSound() {
    if (song.getVolume()>0) {
    song.setVolume(song.getVolume()-10);
    trace(song.getVolume());
    // see values in output window
    } else {
    clearInterval(counter);
    }
    }

    ++++++++++++++++++++++
    I'm thinking I've got to somehow reset the volume, but I don't understand how. This is driving me nuts - any suggestions?

  4. #24
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    kimseng,
    set the variable on frame 1 as such.

    Code:
    //Sound 1
    mySound1 = new Sound();
    mySound1.loadSound("background.mp3");
    mySound1.setVolume(number);
    //Sound 2
    mySound2 = new Sound();
    mySound2.loadSound("vocal.mp3");
    mySound2.setVolume(number);
    this is how its done

  5. #25
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    when you use clearInterval, it refers to the variable given to the setInterval();
    example
    if on frame 1 you had a function and used setInterval as a timer for frame movement.

    function next(){
    your function here;
    }
    counter = setInterval(next, 3000);

    on frame whatever, you would have...
    clearInterval(counter);

    this would clear the interval set in frame 1.


  6. #26
    Could you send me a sample file to do the below?

    a ball keep bouncing on the main timeline and the movement of the ball will synchronize with a "stream mode" sound.

    A background music will keep looping at the same time and when the "mute" button on the main timeline is clicked, the looping background sound will fade off and stop BUT the ball and the "stream mode" sound will still playing.

    thanks!!

  7. #27
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    i'll create a sample fla an post it

  8. #28
    Sleepy
    Join Date
    Apr 2001
    Location
    Tallahassee, FL
    Posts
    498
    Originally posted by Kennyb
    In addition, you might want to check out my tutorial on sound objects in the link in my sig.

    and may I mention what a damned fine tut it is too

    thank you for doing that tut kennyb ... good stuff [very concise]

  9. #29
    Senior Member
    Join Date
    Apr 2002
    Posts
    682
    Hey, thanks.

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