5 Replies Latest reply on Oct 3, 2006 9:48 PM by kglad

    Sound-ctionscript *PLEASE HELP*

    rfkrocktk

      Everywhere I go, everyone refuses to help me out with this. I know it isn't THAT hard and the questions that I am asking are important and relevant. Anyways, I just hope someone would help me out with this. It would really make my day

      Basically, I am trying to create and control a sound in actionscript.
      Here is my code on frame one of a movie with nothing in the library but a sound file 'Background Music.wav'. I set the linkage of it to "track1". Code:

      quote:

      stop();
      //declare the sound as a variable, start it with inital volume of zero.
      var firstSound = new Sound("track1");
      firstSound.start();
      firstSound.setVolume(0);


      //event that fires at framerate that states : if the volume of firstSound is less than 100, add one to it.. If the volume of firstSound is equal to 100, get rid of the onEnterFrame.
      this.onEnterFrame = function() {
      if(firstSound.getVolume() < 100){
      firstSound.setVolume(+1);
      }
      else{
      delete this.onEnterFrame();
      }
      }


      Alright, now here's what I'm trying to accomplish. I'm trying to create a basic sound fade in that is uncontrollable by the enduser. I basically want the sound to fade in and then fade out on the release of a movie clip.
      First, I just want to get this code working and at least have an explanation of how to generally set up actionscript sound. Better yet, if anyone can point me to a tutorial on how to do all of this stuff (including an explanation of an onEnterFrame state, I'm still unsure on how to use these) that would help loads as well.

      Hopefully someone out there is willing to help me out!

      - TK