3 Replies Latest reply on Dec 7, 2011 7:17 AM by kglad

    Problem adding audio in Flash cs3

    andreahil Level 1

      I am working on a Flash cs3/as2 touch screen enabled kiosk presentation. It has a home page .fla file with an empty movie clip (empty_mc) which movie clips load into from a player .fla file. The player .fla file also has an empty movie clip (empty_mc2) which movie clips load into from a slide .fla file. All I need is to simply have background music playing during the entire presentation, but with volume control, play and stop capabilities. I've used the code shown below, but I get overlapping and echo noise. I've placed the code in the player .fla file in the actions layer. Obviously I have placed the code improperly and would like to know the simplest way to achieve the desired outcome which as I stated above, is to have, aside from the intro., continuous background music.

       

      //VolumeControl Play Stop

      bgSound = new Sound(soundLoader);

      bgSound.loadSound("sound1", true);

      bgSound.start(0, 99);

      play_btn.enabled=false;

      slider.slideBar._y = -50;

      slider.slideBar.onEnterFrame = function() {

      bgSound.setVolume(0-this._y);

      };

      slider.slideBar.onPress = function() {

      startDrag(this, false, this._x, -65, this._x, 0);

      };

      slider.slideBar.onRelease = slider.slideBar.onReleaseOutside=function () {

      stopDrag();

      };

      stop_btn.onRelease = function() {

      bgSound.stop();

      play_btn.enabled=true;

      stop_btn.enabled=false;

      };

      play_btn.onRelease = function() {

      bgSound.start(0, 99);

      play_btn.enabled=false;

      stop_btn.enabled=true;

      };

        • 1. Re: Problem adding audio in Flash cs3
          kglad Adobe Community Professional & MVP

          that code should be in the main (_level0) swf and should only execute once.

          • 2. Re: Problem adding audio in Flash cs3
            andreahil Level 1

            I don't know if the homepage.swf is the main (_level0) swf, or if the player.swf that contains the homeshow.swf that loads into the homepage.swf is the main (_level0) swf. I'm assuming the homepage.swf is the main swf because it is the swf that plays the entire presentation? So, I need to place the code in the actions layer of the homepage.fla? Does it need to go into the existing empty_mc?

            • 3. Re: Problem adding audio in Flash cs3
              kglad Adobe Community Professional & MVP

              are you creating a projector file that will open on your kiosk or an html file that will open in an operating system web browser on your kiosk?

               

              if the former, the projector file contains the _level0 code.  if the later, the html file will embed the _level0 swf.

               

              that code needs to go on a timeline that contains soundLoader,slider,stop_btn and play_btn.  and you  don't need to use soundLoader:

               

               

              var initialized:Boolean;

               

              if(!initialized){

              initialized=true;

              bgSound = new Sound(this);

              bgSound.loadSound("sound1", true);

              bgSound.start(0, 99);

              }

               

              //VolumeControl Play Stop

              play_btn.enabled=false;

              slider.slideBar._y = -50;

              slider.slideBar.onEnterFrame = function() {

              bgSound.setVolume(0-this._y);

              };

              slider.slideBar.onPress = function() {

              startDrag(this, false, this._x, -65, this._x, 0);

              };

              slider.slideBar.onRelease = slider.slideBar.onReleaseOutside=function () {

              stopDrag();

              };

              stop_btn.onRelease = function() {

              bgSound.stop();

              play_btn.enabled=true;

              stop_btn.enabled=false;

              };

              play_btn.onRelease = function() {

              bgSound.start(0, 99);

              play_btn.enabled=false;

              stop_btn.enabled=true;

              };