6 Replies Latest reply on Dec 21, 2017 11:33 AM by kglad

    Shortcut  "PLAY" key for Library section?


      Hello guys! Khai here again! I got some question here, is there any shortcut key for testing the music in library?


      like when I want to test a bunch of sound which I downloaded from website, and it install everything in the flash files so I have to test them in adobe animate. But I notice that I have to do one by one using mouse clicking play and clicking another music, that's kinda wasting my time doing it.


      I hope there will be some shortcut key, at least to play the music

      (Like the frames, we adjust frames by hitting  < and > key. And "enter" is to play the scene.


      So I want to ask is there any PLAY  key for library?





      Thank you!

        • 1. Re: Shortcut  "PLAY" key for Library section?
          kglad Adobe Community Professional & MVP

          you might be able to add a jsfl shortcut to do that.  otherwise, no.

          • 2. Re: Shortcut  "PLAY" key for Library section?
            robdillon Most Valuable Participant

            Here’s the link to all of the existing keyboard shortcuts in Animate: Adobe Animate CC keyboard shortcuts

            and here’s the link to creating your own custom shortcuts: Keyboard shortcuts

            • 3. Re: Shortcut  "PLAY" key for Library section?
              JoãoCésar Adobe Community Professional & MVP

              It seems Animate cannot do this with default shortcuts and I couldn't find a method in the JSFL API to handle this.


              The solution I found was to create a simple panel for Animate CC that gets the song url from the authoring environment. Then the SWF panel plays the song using ActionScript 3.


              Download it here: Play Library Sound Extension.


              For now, it only plays the songs if they actually exist in the original path from where they were imported. But I'll try to find some time to update the panel to play the songs without depending on it - if it's possible.


              Installation instructions:

              1. Copy the 'Play Library Sound.swf' and 'play_library_sound.jsfl' files to:


              [INSTALLATION DRIVE]\Users\[USER ACCOUNT]\AppData\Local\Adobe\[ANIMATE VERSION]\en_US\Configuration\WindowSWF.



              C:\Users\Admin\AppData\Local\Adobe\Animate CC 2018\en_US\Configuration\WindowSWF


              2. Restart Animate CC if it's opened.

              3. Inside of Animate CC, go to Window > Extensions > Play Library Sound.


              How to use:

              1. Select a sound item in the library to play it.


              For reference, here is the code:



              import flash.events.Event;
              import flash.media.Sound;
              import flash.media.SoundChannel;
              import flash.media.SoundTransform;
              import flash.net.URLRequest;
              import flash.errors.IOError;
              import flash.events.IOErrorEvent;
              var sChannel:SoundChannel;
              var previousSoundPath:String;
              var soundPath:String;
              function start():void
                  ExternalInterface.addCallback('callMySWF', jsfl);   
                  stage.addEventListener(Event.ENTER_FRAME, loop);
              function loop(e:Event):void
                  MMExecute('fl.runScript( fl.configURI + "/WindowSWF/play_library_sound.jsfl");');
                  if (previousSoundPath != soundPath)
                      if (sChannel)
                      songName.text = soundPath;
                  previousSoundPath = soundPath;
              function jsfl(arg:String):void
                  soundPath = arg.replace("file:///", "").replace("|", ":");
              function playSound(path:String, volume:Number = 1, start:Number = 0, loops:int = 0):void
                  if (sound) sound.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
                  if (sChannel) sChannel.stop();   
                  var sound:Sound = new Sound();   
                  var sTransform:SoundTransform = new SoundTransform();       
                  sound.load(new URLRequest(path));
                  sChannel = sound.play(start, loops);
                  sTransform.volume = volume;
                  sChannel.soundTransform = sTransform;
                  sound.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
              function errorHandler(event:IOErrorEvent):void
                  if (soundPath != "Select a sound item in the Library.")
                      songName.text = soundPath + " not found.";



              var soundURL = "";
              function soundPath()
                  var doc = fl.getDocumentDOM();
                  var errorMessage = "Select a sound item in the Library.";
                  if (doc.library.getSelectedItems()[0] && doc.library.getSelectedItems()[0].itemType == "sound")
                      return doc.library.getSelectedItems()[0].sourceFilePath;
                      return errorMessage;
              function callMyPanel(panelName, arg)
                  if(fl.swfPanels.length > 0)
                      for(i = 0; i < fl.swfPanels.length; i++)
                          if(fl.swfPanels[i].name == panelName)
                              fl.swfPanels[i].call("callMySWF", arg);
                      fl.trace("no panels");
              soundURL = soundPath();
              callMyPanel("Play Library Sound", soundURL);





              • 4. Re: Shortcut  "PLAY" key for Library section?
                kglad Adobe Community Professional & MVP

                jsfl can do it alone and (imo) easier than that.  select the library sound>select frame> attach the sound to a frame>add frames (if needed)>start frame playback>stop frame playback>remove the sound (ie, add null), repeat.  put the jsfl the commands folder and create a shortcut.


                and that's not necessarily the easiest solution, but it's easier than the solution you proposed.

                • 5. Re: Shortcut  "PLAY" key for Library section?
                  JoãoCésar Adobe Community Professional & MVP

                  I assumed the OP just want to use the feature not implement it.


                  To use the panel is as easy as:

                  - To copy two files to the WindowSWF folder;

                  - (Re)open Animate;

                  - Select the panel from the Extensions menu.


                  This is not hard.


                  It's indeed more complicated if you wish to code the panel for yourself. I just put the code as a reference just in case of some search engine adventurer is passing by.


                  I thought about the possibility you suggested but I really don't want to change the user's timeline and playback. Anyway, I would really like to see how you would implement this, k.





                  • 6. Re: Shortcut  "PLAY" key for Library section?
                    kglad Adobe Community Professional & MVP

                    var tl = fl.getDocumentDOM().getTimeline();




                    var layer_index = addLayerF();




                    function playSoundF(si,layer_index) {




                    tl.layers[layer_index].frames[0].soundLibraryItem = si;

                    if (tl.layers[layer_index].frameCount < 100) {

                    tl.insertFrames(100);  // using the undo command in the ide is best way i can see to undo any timeline changes

                    tl.currentFrame = 0;






                    function nextSoundF() {

                    var siA = fl.getDocumentDOM().library.getSelectedItems();

                    if (siA.length==0) {

                    siA = fl.getDocumentDOM().library.items;


                    for (var i = 0; i < siA.length; i++) {

                    if (siA[i].itemType == 'sound') {

                    return siA[i];



                    alert('end library: no more sounds');

                    return null;


                    function addLayerF(s) {

                    return tl.addNewLayer();


                    function removeLayerF(n) {