Mixing sounds in Flash MX
Just when I was wrapping up a project for one of my clients, a list of a few last-hour requests came in. This is a CD-ROM containing a collection of presentations, with slides and live voice-overs, so I’ve been playing one sound at a time; now they wanted to keep the introductory music track playing in the background while the presenter’s speech introduces the work.
After nearly 30 minutes of trying and getting the same volume for both sounds every time, I finally made it work. What was happening? I’m not sure how to explain it in formal terms, I would say that two sound objects can’t be defined in the same timeline and have independent values for their properties. In order to manipulate the volume and pan settings correctly, our sound objects must be defined in different timelines:
this.createEmptyMovieClip("target1", ++d);
this.createEmptyMovieClip("target2", ++d);
sound1 = new Sound(target1); // defining sound1 in target1
sound1.attachSound("music");
sound1.start();
sound1.setVolume(20);
sound2 = new Sound(target2); // defining sound2 in target2
sound2.attachSound("voice");
sound2.start();
sound2.setVolume(100); // this isn't really needed
Notice that even if the sound objects are placed in disperse clips, we still refer to their variable names in the local timeline. We could even have something like:
sound_n = new Sound(_root.myMovie.mySubMovie.target_n);
and still call the name of the local variable.
Comments
No Comments
Leave a reply