# attachSound in an embedded swf

**URL:** <https://forum.kirupa.com/t/attachsound-in-an-embedded-swf/208120>\
**Category:** flash\
**Created:** [November 25, 2006, 3:25am UTC](https://forum.kirupa.com/t/attachsound-in-an-embedded-swf/208120 "2006-11-25T03:25:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [November 25, 2006, 3:25am UTC](https://forum.kirupa.com/t/attachsound-in-an-embedded-swf/208120/1 "2006-11-25T03:25:34Z")

</div>

I have a swf file that contains some embedded and correctly linked sound files in its library - and it works correctly when i attach these sounds, if i play the swf by itself.

But if i try to embed it into another parent swf, the sounds no longer work.  
here is the code used to attach the sounds

```auto

var good:Sound = new Sound();
this.good.attachSound("correct");
var bad:Sound = new Sound();
this.bad.attachSound("wrong");
var redbootin:Sound = new Sound();
this.redbootin.attachSound("redbootsound");

```

the only solution i have discovered so far is to embed the sounds in the parent swf, and if i do this the above code works correctly, despite the fact that the AS references “this” which should refer to the timeline of the child swf.

Is there something special about the attachSound command that i dont kno?

:crazy:
