3 Replies Latest reply on Nov 2, 2007 6:51 AM by chrisatflash

    Question about controlling sounds..

    chrisatflash Level 1
      The goal of my script is if a movieclip moves from right to left the sounds wil pan also from right to left.
      And so far it works! But when i want more sounds, the sound effect in Flash does not do what it supposed to do.
      If you see my trace, the values per movieclip is increasing the correct way.

      I know the standars for attaching a sound like:

      -) your sound object must be connect to a movieclip ( yoursound = new Sound(yourMovieClip);
      This way you can control the sound individual without paning all the sounds that are on the stage.

      And i tried to do this, but still the next sounds come in different then the first sound.
      Also if i want to stop this sound yoursound.stop(); ..is stops all the sounds ?

      If you want to test this code you have to do the following:

      Your Stage size must be: 600 x 240;
      In your library must be sounds files (Longer then 5 seconds) named: "geluidje1" (Linkage id)
      And draw a square and convert it to a movieclip and delete this. And in your library give this square
      the linkage id: "vierkant"

      Please let me know if someone does now how to fix this.

        • 1. Re: Question about controlling sounds..
          chrisatflash Level 1
          Am i the only one with this problem?
          • 2. Re: Question about controlling sounds..
            Rothrock Level 5
            Probably you are today.

            I see a few things and I'm not quite sure exactly the solution.

            First why are you using eval() in your sound constructor? I would either use:


            like you have used elsewhere or even better I would capture a reference from the attach movie and use that.

            var curClip:MovieClip=this.attachMovie("vierkant","vierkant"+v, etc....

            Which brings us to the next problem. You are creating a Sound object each time, but you aren't giving the sound a new name each time. You are reassigning it to the same geluidjel variable. So you need to give each sound its own name as well as attach it to a different clip. I might do that like this:

            curClip.geluidjel=new Sound(curClip);

            Or something like that. Of course then you will have to iterate through all you clips on stage and look for their geluidjel property to control each one. Ontdekt dat merk?
            • 3. Re: Question about controlling sounds..
              chrisatflash Level 1
              Thanks for the tips! After spending lots of hours, testing.. and testng.. i finally got it to work!

              Here is my code: