# Attachsound doesnt work when loaded?

**URL:** <https://forum.kirupa.com/t/attachsound-doesnt-work-when-loaded/103134>\
**Category:** Uncategorized\
**Created:** [March 2, 2004, 10:08am UTC](https://forum.kirupa.com/t/attachsound-doesnt-work-when-loaded/103134 "2004-03-02T10:08:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![noxious](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@noxious](https://forum.kirupa.com/u/noxious)\
**Post date:** [March 2, 2004, 10:08am UTC](https://forum.kirupa.com/t/attachsound-doesnt-work-when-loaded/103134/1 "2004-03-02T10:08:03Z")

</div>

```auto
playSound = function(name, varSound) {
	name.stop();
	mSound = new Sound();
	mSound.attachSound(varSound);
	mSound.onSoundComplete = function() {
		name.play();
	
	};
	mSound.start();
};

```

this is the code i am using in the MAIN movie and is placed on the root of the timeline…

On my MOVIE1 which is loaded on the MAIN movie, i placed this code to call that function on certain frames

```auto
 _root.playSound(this,"myMusic.mp3");

```

myMusic.mp3 is the linkage identifier…

the problem is the sound doesnt play at all… but when i copy playSound function on the \_root of the MOVIE1 and test it (just playing the MOVIE1 without loading it to the main movie), it works fine… what seems to be wrong here? what did i missed?

Thanks for any help…
