3 Replies Latest reply on Jun 14, 2007 7:19 PM by Bryan Woods

    Load External SWF with Preloader

    m_u_r Level 1
      I have this script that loads a random SWF. It works great except the preloaders in the SWF do not work. Does anyone know what I'm doing wrong?

      choice = Math.round(Math.random()*5);
      switch (choice) {
      case 0 :
      location.loadMovie("0.swf");
      break;
      case 1 :
      location.loadMovie("1.swf");
      break;
      case 2 :
      location.loadMovie("2.swf");
      break;
      case 3 :
      location.loadMovie("3.swf");
      break;
      case 4 :
      location.loadMovie("4.swf");
      break;
      case 5 :
      location.loadMovie("5.swf");
      break;
      }


      Here is the code I am using to preload the individual SWFs:


      function checkLoad() {
      var lBytes = _root.getBytesLoaded();
      var tBytes = _root.getBytesTotal();
      var percentLoaded = Math.floor((lBytes/tBytes)*100);
      preloader.gotoAndStop(percentLoaded);
      preloader.cursor.percent.text = percentLoaded+"%";
      if (lBytes>=tBytes && tBytes>0) {
      if (count>=12) {
      clearInterval(checkProgress);
      gotoAndPlay("main");
      } else {
      count++;
      }
      }
      updateAfterEvent();
      }
      checkProgress = setInterval(checkLoad, 50);
      stop();