3 Replies Latest reply on Apr 1, 2009 5:35 PM by kglad

    help with simultaneous on off sound buttons

    Dan Lauter
      hi, I'm an intermediate flash user and I've made a file for my kids in class that has some sound on-off buttons. they are set to play once or loop depending on length by simple mouse click. they will play simultaneously if more than one is clicked individually on the page. I'm trying to make the page so the kids can just select the sound button icon, drag as many of them as they want (usually 2 -4 sounds at a time) into a box at the bottom of the page where they will then just play and loop. if they are dragged out of the box, that sound will stop. if another is dragged into the box it's sound will then join the ones that are already looping. can someone please help point me to the action script I need to write for this to occur? thanks. please email me at school: dlauter@unis.org if you can.
        • 1. Re: help with simultaneous on off sound buttons
          kglad Adobe Community Professional & MVP
          import your sounds to your library, give them each a linkage id, assign a property of your icons to be equal to the corresponding linkage id.

          then use standard drag and drop code along with a check of your icons _droptarget to start and stop your sounds.
          • 2. Re: help with simultaneous on off sound buttons
            Dan Lauter Level 1
            thanks so much for the reply! It's a bit over my head, but I'm eager to try and learn this operation. so the linkage ID and the button property should be named the same? I can see when I right click in the library on each the window that pops up for linkage and for property? sorry for my dumbness :)

            dan
            • 3. Re: help with simultaneous on off sound buttons
              kglad Adobe Community Professional & MVP
              yes, using the linkageID will allow you to start the sound associated with each icon.

              so, if you have an icon with instance name drumsIconMC and you have a sound in your library that you've assigned a linkage id of drumsID, you can use:

              drumsIconMC.soundID = "drumsID";
              drumsIconMC.onPress=function(){
              this.startDrag();
              }
              drumsIconMC.onRelease=function(){
              this.stopDrag();
              if(eval(this._droptarget) == boxMC){ // assuming your drop target box is named boxMC
              if(this.s == undefined){
              this.s = new Sound();
              this.s.attachSound(this.soundID);
              }
              this.s.start(0,999); // <- asssuming you want to loop your sound 999 times
              } else{
              if(this.s != undefined){
              this.s.stop();
              }
              }
              }