3 Replies Latest reply on Jun 7, 2011 12:20 PM by kglad

    Can preloader sound settings affect the swf it loads?


      Thanks to kglad, my preloader music now fades out as the progress bar completes (the preloader code is below with the new code in bold).


      However, the new code added to the preloader seems to be affecting the sound in the main swf (the bigger swf that the preloader loads - 'lesson.swf' - which is a series of exercises).


      The exercises in the main swf have sound cues for right and wrong answers. The first time the main swf loads, there is no sound at all in the exercises. If I navigate to another page of the website and come back to the exercises, the sound is normal. But if I navigate to another page and come back a third time, the sound is audible, but reduced in volume. If I keep switching off the page and back to the page, the sound varies from no sound to full sound to about half the full volume.


      Is it possible that the code on frame 2 of the preloader, the code that sets the volume for the preloader music, is also applying to the main swf, so that whatever point the preloader progress bar gets to before the main swf loads becomes the volume of the main swf? The first time the preloader runs, the progress bar goes all the way from left to right and the sound volume fades to zero. Then the volume in the main swf is zero. The next time the preloader runs, it only gets a little way across before the exercises come up, and the sound in the exercises is full volume.


      Is there a way to fix this? I should add that if I comment out the new code that fades out the preloader music, all the sound works normally. Thanks in advance.



      var alreadyExecuted:Boolean

      var s:Sound=new Sound(TitleScreen.Notes_mc);


      this.createEmptyMovieClip("container_mc", "100");


      my_mc = new MovieClipLoader();


      preload = new Object();


      preload.onLoadStart = function(targetMC) {

                      container_mc._visible = false;

                      loadingBar._visible = true;

                      loadingBorder._visible = true;

                      loadingText._visible = false;

                      loadingTitleScreen._visible = true;

                      loadingLessonName._visible = true;



      preload.onLoadComplete = function(targetMC) {

                      container_mc._visible = true;

                      loadingBorder._visible = false;

                      loadingBar._visible = false;

                      loadingText._visible = false;

                      loadingTitleScreen._visible = false;

                      loadingLessonName._visible = false;




      my_mc.loadClip("lesson.swf", "container_mc");




      loadingBar._width = (container_mc.getBytesLoaded()/container_mc.getBytesTotal()) * 576.0;

      loadingText.text  = "Loading " + Math.round(container_mc.getBytesLoaded() / 1024) + " K  of "+ Math.round(container_mc.getBytesTotal() / 1024) + " K";


      var vol:Number=Math.round(100*container_mc.getBytesLoaded()/container_mc. getBytesTotal())