Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8586955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:26:43+00:00 2026-06-11T22:26:43+00:00

Ok this thing is awesome! I got SoundManager 2 setup within my .js file

  • 0

Ok this thing is awesome! I got SoundManager 2 setup within my .js file and have audio playing on my page. My only question at the moment, is figuring out how to play audio outside of the soundManager.setup({…}). For example the following works great…

function mSound() {
/*SETUP SOUND MANAGER 2*/
soundManager.setup({
// where to find flash audio SWFs, as needed
url: 'audio/',
onready: function() {
console.log('SM2 is ready to play audio!');

    /*MY SOUND COLLECTIONS*/ 
    soundManager.createSound({
    id: 'myIntro',
    url: 'audio/Indonesia.mp3',
    autoPlay: false,
    volume: 15
    });
    soundManager.play('myIntro');

}
});
}

But if I try to place soundManager.play(‘myIntro’), into another function like…

function mIntro() {
 soundManager.play('myIntro');
}

…the audio does not play. Any advice will be great!

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:26:44+00:00Added an answer on June 11, 2026 at 10:26 pm

    I think I solved it. By setting up local variables as parameters for my mSound() function like so…

    function mSound(id,url,volume) {
    this.id = id;
    this.url = url;
    this.volume = volume;
    
    /*SETUP SOUND MANAGER 2*/
    soundManager.setup({
    url: 'audio/',
    onready: function() {
             //console.log('SM2 is ready to play audio!');
         /*MY SOUND COLLECTIONS*/ 
         soundManager.createSound({
         id: id,
         url: 'audio/'+ url,
         volume: volume
         });
         soundManager.play(id);
         }
    }); 
    }
    

    …I’m now able to do cool stuff like this within other javascript functions and play sound!

    mSound('myIntro','Indonesia.mp3',5);
    

    And you can still still use the soundManager global object properties after you load your custom function. For example you can pause your track like this later in your code…

     soundManager.togglePause('myIntro');
    

    Hope this helps someone 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this thing working mostly. What I don't get is, if I have
I have this thing that i need to do and some advices will be
Suppose I have a doc structure like this: thing: { name: { first: John,
I got started by following this awesome tutorial , but wanted to do the
I've got a page on website that is using the awesome drag and drop
I have this thing I m trying to do. I have a main picture
I have been a long time stalker to this awesome site and It has
I didn't find any question like this here. Yesterday I finally got Gingerbread 2.3.4
Im using Valums awesome file uploader - https://github.com/valums/file-uploader One thing i want to add
I've currently got CC.Net setup for doing builds and it's awesome. But now I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.