A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Different Sound Volumes Trouble.

  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    3

    Different Sound Volumes Trouble.

    Please, help me. I have two sounds in my project library

    backgr.mp3 and myVoice.mp3

    backgr is supposed to be quiet, and myVoice loud, and the whole movie is suppose to loop.

    I've made a separate movie clips and separate layers for each sound, and linked them accordingly :

    [ Layer : me ]

    _root.createEmptyMovieClip("containerMe",1);
    me = new Sound(containerMe);
    me.attachSound("My Voice");
    me.setVolume(100);
    me.start(0,999);

    [Layer : Background]

    _root.createEmptyMovieClip("containerBackground", 1);
    backgr = new Sound(containerBackground);
    backgr.attachSound("background01");
    backgr.setVolume(10);
    backgr.start(0,1);

    This works fine, until it's time for the whole movie to start over, and than all the volumes reset to 100. I have no idea how to fix this. Help please !!!

  2. #2
    Senior Member guardiankitty's Avatar
    Join Date
    Dec 2006
    Location
    Here
    Posts
    215
    I would recommend:

    Actionscript Code:
    //_root.createEmptyMovieClip("containerMe",1);
    me = new Sound();
    me.attachSound("My Voice");
    me.setVolume(100);
    me.start(0,999);


    //_root.createEmptyMovieClip("containerBackground", 1);
    backgr = new Sound();
    backgr.attachSound("background01");
    backgr.setVolume(10);
    backgr.start(0,1);

    And if this doesn't work, (I dont know how you have it set up, but...) when the movie is to start over, try replaying from the second frame.




    The real piece of advice that I can give ya, is to early on in development choose to have the project be one of 'programming' or 'non-programming'.

    For instance, it would be 20-20 hindsight on my part to point out , you should never just let the _root movieclip 'replay', if you are working with any sort of code.

    For instance, in every project I write now-a-days, there is only one frame in the main timeline, and everything in the project is in the library, and everything else is loaded in with includes and packages.



    Hope this helps, and good luck!
    -GK>'.'<

  3. #3
    Junior Member
    Join Date
    Jun 2010
    Posts
    3
    It's a very simple movie, that was the entire AS code.

    Your solution doesn't work. If those two sounds aren't contained by separate movie clips, they are both always on the same volume.

    I need the first one to be set to volume 20 and the second to 100, and without them both jumping to 100 once the movie starts over.

    Both of them are on their separate layers, but I can put them on the same one, if that'll help.

  4. #4
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Code:
    if (containerMe == undefined) {
    	var containerMe = _root.createEmptyMovieClip("containerMe", 1);
    	var me = new Sound(containerMe);
    	me.attachSound("My Voice");
    	me.setVolume(100);
    	me.start(0,999);
    }
    if (containerBackground == undefined) {
    	var containerBackground = _root.createEmptyMovieClip("containerBackground", 2);
    	var backgr = new Sound(containerBackground);
    	backgr.attachSound("background01");
    	backgr.setVolume(10);
    	backgr.start(0,1);
    }

  5. #5
    Junior Member
    Join Date
    Jun 2010
    Posts
    3
    Thank you. That did the trick.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center