Skip to main content
eslmaxx
Known Participant
October 15, 2017
Answered

How can I call mp3 files from an external folder in Animate?

  • October 15, 2017
  • 1 reply
  • 848 views

All the information I can find on using sound involves importing the file into the library or to the stage. But I want to keep the sound files in an external folder and have them play whenever a particular button is pressed.  This reason for this is I may have 30+ buttons on a page, each of which will play a different audio file of a few seconds.  I am not sure if I want that many sound files in my library.

In Flash it was an easy task.  In AS2 it was something like

on (release) {

  

    myfilesound = new Sound();

    myfilesound.loadSound("conf/r.mp3",true);

}

I am working on an HTML5 Canvas.  Obviously script isn't written on buttons anymore, but rather on frames.  I am wondering if there is some script I can add to an Actions frame that will play an mp3 file located in an external folder.

Please anyone let me know if this is possible in Animate.

Thank you.

[Moved from the non-technical Lounge Forum to the specific Program forum... Mod]

[Here is the list of all Adobe forums... https://forums.adobe.com/welcome]

    This topic has been closed for replies.
    Correct answer Colin Holgate

    When you bring sounds into the library of HTML5 Canvas, then publish, all of the sounds are put into an external folder. You can, after publishing even, change the files for better compressed ones, or higher quality ones, without having to republish.

    There is most likely an equivalent of loading and playing a sound like you did with AS2, but if you're ok with letting the library organize things for you, playing a sound is as simple as:

    createjs.Sound.play("r");

    The library is happy to take hundreds of sounds.

    One thing to know, in order to play a sound 'r' you will have to look at the library list view, double click on the Linkage column next to the sound you want, and give it a name. The name doesn't have to match the mp3 filename.

    1 reply

    Colin Holgate
    Colin HolgateCorrect answer
    Inspiring
    October 15, 2017

    When you bring sounds into the library of HTML5 Canvas, then publish, all of the sounds are put into an external folder. You can, after publishing even, change the files for better compressed ones, or higher quality ones, without having to republish.

    There is most likely an equivalent of loading and playing a sound like you did with AS2, but if you're ok with letting the library organize things for you, playing a sound is as simple as:

    createjs.Sound.play("r");

    The library is happy to take hundreds of sounds.

    One thing to know, in order to play a sound 'r' you will have to look at the library list view, double click on the Linkage column next to the sound you want, and give it a name. The name doesn't have to match the mp3 filename.

    eslmaxx
    eslmaxxAuthor
    Known Participant
    October 16, 2017

    Thank you very much.  That may be a perfect answer, and it's really important to me.

    By the way, I think I recognize your name.  You may have helped me with a previous question or set of questions a year or so ago regarding Animate.  I've since been able to rewrite almost my whole project, which had originally been written in AS2.

    Thanks again for your help