3 Replies Latest reply on Dec 21, 2009 12:54 PM by Ned Murphy

    trouble creating a preloader using a video


      Hi guys, im a bit bit stuck and hope someone can help.


      I am making a preloader for a site and I want to use a video in place of the usual loading bar. the video is 428 frames long and I have called it Preloader_MC.


      I have set up the typical get bytes loaded:


      totalBytes = Math.round(getBytesTotal() / 1024);
      loadedBytes = Math.round(getBytesLoaded() / 1024);
      percentDone = Math.round((loadedBytes / totalBytes) * 100);
      if (_root._framesloaded>= _root._totalframes) {


      I want my video to go to the frame that corresponds to the % loaded (ie for my 428 long video if 10% of the file had loaded it would go to frame 43) have been trying variations of the followng code:


      preVidFrame = Math.round(Preloader_MC._totalframes / 100)

      Preloader_MC.gotoAndStop(preVidFrame * loadedBytes);


      The idea is that line 1 sets a variable called preVidFrame and sets it to 1% of the total frames in the video. Line 2 then times' preVidFrame (1%) by the % of the bytes loaded and sends Preloader_MC playhead to the resulting frame.


      Am I barking up the wrong tree here, is this even possible. Any help would be greatly appreciated.