title: How do i play a song from library when the preloader is a "x"% of total loaded?
body: <p>I am currently undertaking a final exam based on the presentation of an offline portfolio and I need to make a preloader, where when the process of loading is 25% of total bytes, to play a sound that is imported into the library. I've tried several ways and can’t do it.</p>
  
  <p>I'll leave you the code for my preloader.</p>
  
  <pre><code>//(also this code is a mouse loader in text form)
  
  this.loaderInfo.addEventListener(ProgressEvent.PROGRESS,checkingProgress);
  
  function checkingProgress(event:ProgressEvent):void{
      var procentLoaded:Number = event.bytesLoaded/event.bytesTotal*100;
  
      ptxt.text=int(procentLoaded)+"%";
      if(procentLoaded == 100){
          this.gotoAndPlay(1,"Video-Int");
      }
  }
  
  stage.addChild(ptxt);
  ptxt.mouseEnabled = false;
  ptxt.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);
  
  function fl_CustomMouseCursor(event:Event) {
      ptxt.x = stage.mouseX;
      ptxt.y = stage.mouseY;
  }
  Mouse.hide();
  
  this.addEventListener(Event.ENTER_FRAME, loading);
  
  function loading(e:Event):void {
      var total:Number = this.stage.loaderInfo.bytesTotal;
      var loaded:Number = this.stage.loaderInfo.bytesLoaded;
  
      prel.scaleX = loaded/total;
      if (total == loaded){
          play();
          this.removeEventListener(Event.ENTER_FRAME, loading);
      }
  }
  </code></pre>