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 8019815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:30:23+00:00 2026-06-04T21:30:23+00:00

I a having trouble loading an audio file from the library, I was previously

  • 0

I a having trouble loading an audio file from the library, I was previously loading the sound files externally like so:

var s1:Sound = new Sound(new URLRequest(“Sound/Melody1.mp3”));

However I now need to load them from the library as I have encountered a looping problem with mp3 files.

Below is my attempt, however I am receiving the error:
Scene 1, Layer ‘Actions’, Frame 1, Line 21 1061: Call to a possibly undefined method attachSound through a reference with static type flash.media:Sound.

/* Click to Play/Stop Sound 1
Clicking on the symbol instance plays the specified sound.
Clicking on the symbol instance a second time stops the sound.
*/

Btn_Melody1.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound1);

var fl_SC1:SoundChannel;

//This variable keeps track of whether you want to play or stop the sound
var fl_ToPlay1:Boolean = true;

function fl_ClickToPlayStopSound1(evt:MouseEvent):void

{

if (fl_ToPlay1)

{
    var s1:Sound = new Sound();
    s1.attachSound("Melody1");
    fl_SC1 = s1.play(0,999);

}
else
{
    fl_SC1.stop();
}
fl_ToPlay1 = ! fl_ToPlay1;

}

I can’t see what I am doing wrong, any and all help would be appreciated.

  • 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-04T21:30:26+00:00Added an answer on June 4, 2026 at 9:30 pm

    If you’re doing AS3, there is no attachSound method on MovieClip (see doc) (exist in AS2).

    In order to use a sound in the library.

    1 – add a linkage name to the sound (ex : Sound0);

    2 – instanciate your sound :

    var sound : Sound = new Sound0();
    //do nasty stuff with your sound !
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble loading joint data information from 'animation' node of collada file. First,
i am having trouble loading a record using find by Id from the view.
i am having trouble loading one of my text files into my GUI. I
I'm having trouble loading JQueryUI from Google's CDN. I've got an ASP.NET application that
I am having trouble loading .swf files to my flash app off my cloudstorage
Iam having a bit of a trouble loading content to CKeditor from within Jquery.
I'm new to JADE and am having a bit of trouble loading agents. I
For whatever reason, I'm having trouble loading up a sound with the AVAudioPlayer .
I'm having trouble loading a detailed view from a TableView. The segue doesn't fire
I'm having trouble loading data from sqlite database into a detailed view. The table

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.