# Sound problem with external swf

**URL:** https://forum.kirupa.com/t/sound-problem-with-external-swf/166683
**Category:** Uncategorized
**Created:** [October 21, 2005, 8:05pm UTC](https://forum.kirupa.com/t/sound-problem-with-external-swf/166683 "2005-10-21T20:05:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![essentialDF](https://avatars.discourse-cdn.com/v4/letter/e/e95f7d/32.png) [@essentialDF](https://forum.kirupa.com/u/essentialDF)
#### Post date: [October 21, 2005, 8:05pm UTC](https://forum.kirupa.com/t/sound-problem-with-external-swf/166683/1 "2005-10-21T20:05:40Z")

</div>

Hi all,

I’ve got a flash application that loads flash advertisements into a container and rotates through several SWFs on a schedule… I don’t have access to it, I just make the ads that play.

I’m having a problem getting sound through to these ads though.

Originally, I added the sounds as a layer and it played throughout the movie, but we decided it gets pretty annoying after the first time you hear it (The ads play continuously for 4-5 minute time blocks)

I modified my code to add the sound into the library, set the linkage for actionscript and then call the sound using the following code:

if (\_root.hasPlayed != “Yes”) {  
var my\_sound:Sound = new Sound();  
my\_sound.attachSound(“ep\_teddy\_bear”);  
my\_sound.start(0,0);  
\_root.hasPlayed = “Yes”  
}

This worked when the SWF was loaded by itself, but when another SWF calls it, it doesn’t work. I then changed the code to this:

if (\_root.hasPlayed != “Yes”) {  
newSound = new Sound ();  
newSound.loadSound (“ep\_teddy\_bear.mp3”, true);  
newSound.start (0,0);  
\_root.hasPlayed = “Yes”  
}

this worked both locally and when i loaded it through a simple movie clip that loads the swf into a movieclip called “container”, HOWEVER, again when i uploaded it it didn’t work. I even tried it with no condition in the IF statement, thinking there was a problem with using the \_root object, but still no go. I know it CAN play sound, because i already did, i just want it to play once.

any help would be much appreciated.

cheers
