1 Reply Latest reply on Aug 7, 2009 6:54 AM by kglad

    Sound not loading

    rlinsurf1 Level 1

      I have the following code:

       

       

       

      myVars = new LoadVars(); 
      
      myVars.load("http://charlesnewmanpubl.com/Sweethearts_On_Parade_BRGK.txt");
      
      myVars.onData = function(src){ 
           myVars.decode(src)
           //trace(myVars.faFile);
           
           var faFile:String;
           var sound : Sound;
           
           if (myVars.faFile == undefined) {
              trace("not yet.");
          } else {
              faFile = myVars.faFile;
              trace(faFile + "!");//so far so good
              this.sound.loadSound("http://charlesnewmanpubl.com/media/"+faFile,true);
              clearInterval(param_interval);
           trace(faFile + "!!");//we're ok here
      
           this.sound.onLoad = function(success:Boolean) {//this is where it's failing
              trace(faFile + "!!!");//nada
      
              if (success) {
               this.playing = true
               this.sound.start (this.sound.soundIndex / 1000)
                  trace("Sound loaded");//not here
           }else{
               trace("Sound failed");//or here
                   } 
           }
          }
      }
      

      This is a loadVars of a .txt, one variable of which is the name of a .mp3 file. I test to see if we've gotten all the data from the .txt, and then what the variable "faFile" is. That's then checked twice, both successfully. But when it gets to the section of whether the sound has actually loaded, and then should play, there's no reposrt.

       

       

      So I'm not loading the .mp3, but don't understand why.

        • 1. Re: Sound not loading
          kglad Adobe Community Professional & MVP
          try:

           

           

           

          myVars = new LoadVars(); 
          var sound : Sound;

           
          myVars.onData = function(src){
               myVars.decode(src)
               //trace(myVars.faFile);
              
               var faFile:String;
              
              
               if (myVars.faFile == undefined) {
                  trace("not yet.");
              } else {
                  faFile = myVars.faFile;
                  trace(faFile + "!");//so far so good
                  sound.loadSound("http://charlesnewmanpubl.com/media/"+faFile,true);
                  //clearInterval(param_interval);
               trace(faFile + "!!");//we're ok here
              }
          }

          sound.onLoad = function(success:Boolean) {//this is where it's failing
                  trace(faFile + "!!!");//nada

                  if (success) {
                   this.playing = true
                   this.sound.start (this.sound.soundIndex / 1000)
                      trace("Sound loaded");//not here
               }else{
                   trace("Sound failed");//or here
                       }
               }


          myVars.load("http://charlesnewmanpubl.com/Sweethearts_On_Parade_BRGK.txt");