3 Replies Latest reply on Feb 19, 2010 12:23 PM by kglad

    Loading External Media

    georgerrm

      I am creating a site that triggers video and audio loads at different times.

      example:

      on page one

      var sound:Sound = new Sound();
      sound.onLoad = function(success:Boolean):Void {
          if (success) {
              sound.start();
          }
      };
      sound.loadSound("audio.mp3", false);

      Then on Page 2

      sound.loadSound("audio2.mp3", false);

       

      This works, but the audio takes time load online of course. I have a preloader which reads:

       

      bytes_loaded = Math.round(this.getBytesLoaded());
      bytes_total = Math.round(this.getBytesTotal());
      getPercent = bytes_loaded/bytes_total;
      preloader_mc.loadBar.bar._width = getPercent*200;
      preloader_mc.loadText = Math.round(getPercent*100)+"%";
      if (bytes_loaded == bytes_total) {
          gotoAndPlay(3);
      }

       

      Is there anyway I can incorporate the loading mp3s into my preloader? Is there anyway the preloader can load files which haven't been called yet? am I just better off making each different audio file its own sound object?

       

      Any help is apprieciated.

       

      Thanks.