5 Replies Latest reply on Apr 20, 2011 7:27 AM by kglad

    Sound class problem

    Captain825

      Hi

       

      I have a Flash 8 site that plays music in the background.  When I click on one of the menu choices, the timeline jumps to another frame where the selected page is.  Once at that page, I want the background music to stop and the page's music to start.  Here is what I have:

       

       

      attached to frame 1:

      var s:Sound=new Sound();  // to initialize a sound instance s

       

      then attached to each page keyframe:

      stopAllSounds();

      s.attachSound("thelinkageidofthesoundthatcorrespondstothispage");

      s.start();

       

       

      When the timeline jumps to the page frame, the background music stops but the page's music doesn't start.

       

      Can someone tell me what I'm doing wrong?

       

      Thank you

      Adrian

        • 1. Re: Sound class problem
          kglad Adobe Community Professional & MVP

          are you assigning a linkage id to your sounds?  you need to use those linkage ids in the attachSound argument.

           

          that is, in your library one of your sounds sound have linkage id = "sound1". then use:

           

          s.attachSound("sound1");

          s.start()

          • 2. Re: Sound class problem
            Captain825 Level 1

            Thought that when a thread is marked Answered, I had to start a new one.  Know better now.

             

            What I did was imported a .wav file into the library, right clicked on it and selected Linkage.  In the linkage box I gave it a name "music1" and checked the Export For Actionscript and Export in First Frame options.

             

            Then I attached this code to frame 1: var s:Sound=new Sound();

             

            Then I attached this code to a keyframe on the page where the new music is to play:

            stopAllSounds();

            s.attachSound("music1");

            s.start();

             

             

            When I test the movie, the background music stops when I get to the page but the new music doesn't start.

             

            Thanks again for any help.

             

            Adrian

             

            • 3. Re: Sound class problem
              kglad Adobe Community Professional & MVP

              click your library sound.  at the top of the library panel will be a graphic representation of your sound with a play button.  click the play button.  if you hear your sound:

               

              right click that library sound, click properties and take a screen shot of that panel showing you have "music1" assigned as the linkage id.

              • 4. Re: Sound class problem
                Captain825 Level 1

                Here you go...

                 

                screen.jpg

                • 5. Re: Sound class problem
                  kglad Adobe Community Professional & MVP

                  your linkage id is incorrect.   it should be "music1", not "music1.wav".

                  1 person found this helpful