Skip to content

attachSound() Won’t Play in Loaded Movie- Another Flash Bug!

Categories: Flash

Table of Contents

I came across this bug awhile ago. Lets say you had the following code in a SWF:

noise = new Sound();
noise.attachSound("asound");
noise.start();

It worked perfectly, the sound with the linkage ID in my library names “asound” played and everything was great.
Now try loading that SWF info another SWF, the sound will not play. I searched the net and found this nice little comment here:


“For what it is worth, I had the same issue, and found a solution to this.
When declaring the “new Sound”, you have to specify a target movie clip. For example:
new_sound = new Sound(this)”

Ah-Ha! Specifying this in the Sound object’s constructor magically makes it work. This isn’t anywhere in MM’s docs. Thanks MM for wasting 30 more minutes of my time!