11 Replies Latest reply on Jan 27, 2014 2:09 PM by resdesign

    state management with buzz.js audio

    suthndew

      Hey guys,

       

      Been researching the threads and cannot find the answer!  I really try not to ask until it's the last resort.

       

      I need to figure out how to stop the sound and symbol that is playing when I click another.

       

       

       

      This will help me in all my projects!  Please someone help meeeeeee.

       

      in composition ready I have the sounds listed as such:

       

      var mediaPath = "soundz/";    

       

       

      sym.iSound1 = new buzz.sound("soundz/toilet", {formats: [  "mp3" ]});

      sym.iSound1.bind('loadeddata', function(e){

           var stage = Edge.getComposition(compId).getStage();

      });

       

       

      sym.iSound2 = new buzz.sound("soundz/coffee", {formats: [  "mp3" ]});

      sym.iSound2.bind('loadeddata', function(e){

           var stage = Edge.getComposition(compId).getStage();

      });

       

      on each button, i have this:

       

       

      sym.getComposition().getStage().iSound1.play();

       

      var mySymbolObject = sym.getSymbol("top1");

       

       

      mySymbolObject.play();

       

       

       

       

       

      Please help!  I know how to stop a sound. But there are 10 sounds total. Could I just list code to stop the other 9 sounds on each button?  Seems redudant.

       

      ie

      sym.getComposition().getStage().iSound1.stop();

      sym.getComposition().getStage().iSound2.stop();

      sym.getComposition().getStage().iSound3.stop();

       

      // etc. etc.

       

      var mySymbolObject = sym.getSymbol("top1");

       

       

      mySymbolObject.play();

       

       

       

       

       

       

       

      And here are the project files...

       

       

       


      https://www.dropbox.com/sh/daws4h9yvgkwxg4/fnUerNx6Sl