2 Replies Latest reply on Jul 4, 2017 10:48 AM by Nebulous Dawn

    animate cc for canvas how to import sound

    Nebulous Dawn Level 1

      I have tried multiple code permutations to get my sounds to work correctly with recent versions of animate cc.


      If I simply import sound to the animate library, it does not play from a command like:


      var audio1 = createjs.Sound.play("mysound");


      I eventually got it working but I had to first import it to the library and then drag the sound to the timeline for it to work. It means I would have to hide the sounds after a stop() on the timeline or you'd get an almighty row when the canvas started to run? Surely that can't be right.


      Is there anywhere a clear walkthrough for correctly adding sound to animate cc for canvas?


      Also, is there a way to ensure sounds are loaded before the canvas runs?


      Previously I was using http://code.createjs.com/preloadjs-0.6.1.min.js  with a json file for the sound imports but I am not sure it is having an effect any more. Should I stop doing that?


      I am quite confused at the moment!

        • 1. Re: animate cc for canvas how to import sound
          Colin Holgate MVP & Adobe Community Professional

          For the second question, on many browsers, especially mobile, it requires a user action to trigger sound. So even if there was a way to play sound before the canvas runs, the user would not hear the sound.


          About using sound from code, there's a not very obvious feature. When you try to play a sound, the name you use isn't the name it has in the Name column in the Library, it's the name in the Linkage column. The not-obvious thing is that you can double-click on the Linkage column, then type in the name of your sound. You should try to avoid using exotic characters or spaces. So, an example would be where you have in the Name column:


          my long named sound.mp3


          you double-click the lInkage column and type in:




          then this will work, without needing to drag the sound to the timeline:


          var audio1 = createjs.Sound.play("mysound");

          1 person found this helpful
          • 2. Re: animate cc for canvas how to import sound
            Nebulous Dawn Level 1

            Thanks, that seems to have done the trick. That linkage column is indeed not very obvious.