I’m making a flash tower defense game. I have a clip called “towers”. In that clip, you can find all of the tower types (fire, poison, ice, etc). I basically do gotoAndStop("tower type here") to select the right tower. All these “tower types” also are clips, and in those clips you can find evolutions of this tower type (each time you “upgrade” your tower, its look changes… this is an evolution). Each evolution is a clip, in that clip there is a sound (the one that I must play when the tower shoots an enemy). I do gotoAndPlay("shoot").
The problem is, we can hear towers even though there is a stop() and there shouldn’t be any sound. There’s something I noticed. If I remove the sound of every tower type’s first evolution, everything works fine, I put some towers on the map, upgrade them to their second evolution and I can hear a sound when they shoot. I noticed something else: I don’t have to remove the sound of the first tower in the clip “towers”, same thing with the last tower, they work fine. And it really is because they are first and last. For example: fire is my first tower, ice is the second tower. Fire is working fine, ice is not. If I swap them, then ice is working fine and fire is not working. Only the first tower and the last tower are working.
It makes me believe that my clip hierarchy is too complicated to contain sounds, too complicated for flash. Also, I’m mixing graphics and sounds in a same clip, should I create a clip that contains only sounds?
This leaves me with a wtf face. I seriously don’t understand what’s going on. If this is not clear, just ask for more details. Thank you.
from what you said, i presume, you are drag and droping sounds directly into MovieClips. That is not good idea, it must be pain to manage.
Instead i recommend one of these options:
1) When tower is build, or clicked, or fires or whatever call playSound function, which plays appropriate sound file:
2) If you do not want to use external file, you can import sound to Library, and check “Export for actionscript” in properties of that sound. Than just play it like this