4 Replies Latest reply on Nov 24, 2008 6:15 AM by Ger75

    Fading sound with Actionscript

    Ger75
      I am trying to fade sound with script when a movie clip gets to a certain x value on the stage. Here is the what I have. It probably has problems, as I am an actionscript newbie:

      Script on frame 1:

      MySound = new Sound();
      MySound.attachSound("wind01.mp3");
      MySound.start(0,1000);
      music.setVolume(100);
      vol = 100;
      fade = 5;

      Script on movie clip:

      onClipEvent (enterFrame) {
      if (this._x >= 90) {
      vol = vol-fade;
      } else if (vol<0) {
      vol = 0;
      }
      }

      Can anyone tell me what I am doing wrong? Any help would be greatly appreciated.

      Thanks