Aspirin99
asked on
Controlling sound volume for multiple sound objects across multiple scenes.
I have a client with a project that has a dozen scenes or so. I normally avoid working with scenes, so I'm not sure how to address this problem.
The issue is that he is controlling multiple sound object independently- Meaning, that he has each sound object associated with a movie clip on the scene so he can have different volume level controls for each sound.
e.g.:
sound1 = new Sound(Sound1MC);
sound1.attachSound("Sound1 .aif");
The problem is that when he moves to a different scene, he no longer has access to the movies that were associated with the sound object, and he loses control of the audio.
Is there a way to control multiple sound objects across scenes in this manner? For example, if I assigned the sounds like:
_root.createEmptyMovieClip ('sound_mc ', _root.getNextHighestDepth( ));
_root.soundObject = new Sound(_root.sound_mc);
Would this solve the problem? Or how?
The issue is that he is controlling multiple sound object independently- Meaning, that he has each sound object associated with a movie clip on the scene so he can have different volume level controls for each sound.
e.g.:
sound1 = new Sound(Sound1MC);
sound1.attachSound("Sound1
The problem is that when he moves to a different scene, he no longer has access to the movies that were associated with the sound object, and he loses control of the audio.
Is there a way to control multiple sound objects across scenes in this manner? For example, if I assigned the sounds like:
_root.createEmptyMovieClip
_root.soundObject = new Sound(_root.sound_mc);
Would this solve the problem? Or how?
ASKER
I think you're not aware that if you do it that way, you cannot controll the volume of one sound independent from another sound. That's why you have to associate it with its own movie - like an empty movie.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ramy,
Did you test this or have any experience with it? I just set up and test and can't get that to work.
Here's the FLA I tested with.
http://www.cowfly.com/test/misc/test.zip
Thanks.
Did you test this or have any experience with it? I just set up and test and can't get that to work.
Here's the FLA I tested with.
http://www.cowfly.com/test/misc/test.zip
Thanks.
ASKER
Actually, I think I got it to work, but I have to reassign the volume level on each scene.
Hi
Acutally i tested it, and it workd fine with me ..
do u want me to test your file or it is working now ?
Regards,
Ramy
Acutally i tested it, and it workd fine with me ..
do u want me to test your file or it is working now ?
Regards,
Ramy
ASKER
I think we're done. Thanks for your help.
welcome :)
just a thought, assuming you did go with the movieclip option - you could store all the movies in a global array, and reference them accordingly at any point throughout the movie.
ASKER
Would the global array affect the problem of losing the association with the movie when I load a new scene? I would be happy to open a new question if this line of reasoning has value. With the approach outlined using createEmptyMovieClip, I still have to reset the volume levels at the start of each scene, which seems to be due to losing contact with the movies associated with the sound object's original definition.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I see what you're saying.
ASKER
I don't care how you split it, as I pay a monthly fee for access. However, I have created a more complete solution here:
http://www.kennybellew.com/tutorial/multiple_scenes.htm
For those who might search for a similar solution.
http://www.kennybellew.com/tutorial/multiple_scenes.htm
For those who might search for a similar solution.
There is no need to associate the sound object with any movie clip
simply in the 1st frame or so , create your sound objects
sound1=new Sound()
sound1.attachSound("Sound1
// please note that attachSound gets sound id , meaning that the sound file is already in the library, but if you want to load it , then you use .loadSound("sound_file.mp3
after you create all your sound object , you can control it anywhere (but you have to call its path right)
to avoid mistakes you can
_root.sound1.setVolume(50)
Regasrds,
Ramy