home *** CD-ROM | disk | FTP | other *** search
- if(gLoading)
- {
- loadedBytes = _parent.getBytesLoaded();
- loadedSize = formatBytes(loadedBytes);
- loadedFrames = _parent._framesLoaded;
- gCurrentTime = getTimer();
- var elapsedMinutes = Math.floor((gCurrentTime - gStartTime) / 1000 / 60);
- var elapsedSeconds = Math.floor((gCurrentTime - gStartTime) / 1000 % 60);
- if(String(elapsedSeconds).length == 1)
- {
- elapsedSeconds = "0" + elapsedSeconds;
- }
- elapsedTime = elapsedMinutes + ":" + elapsedSeconds;
- frameCounter++;
- if(gCurrentTime - gStartTime >= gSampleTimer + 1000)
- {
- framesPerSecond = frameCounter;
- frameCounter = 0;
- bytesPerSecond = loadedBytes - gSizeSample;
- sizePerSecond = formatBytes(bytesPerSecond);
- if(STREAM && PLAY_TYPE == "auto")
- {
- if(loadedFrames / framesPerSecond > (totalBytes - loadedBytes) / bytesPerSecond)
- {
- _parent.play();
- }
- }
- var estimatedMinutes = Math.floor(totalBytes / bytesPerSecond / 60);
- var estimatedSeconds = Math.floor(totalBytes / bytesPerSecond % 60);
- if(String(estimatedSeconds).length == 1)
- {
- estimatedSeconds = "0" + estimatedSeconds;
- }
- estimatedTime = estimatedMinutes + ":" + estimatedSeconds;
- var estimatedMinutesLeft = Math.floor((totalBytes - loadedBytes) / bytesPerSecond / 60);
- var estimatedSecondsLeft = Math.floor((totalBytes - loadedBytes) / bytesPerSecond % 60);
- if(String(estimatedSecondsLeft).length == 1)
- {
- estimatedSecondsLeft = "0" + estimatedSecondsLeft;
- }
- estimatedTimeLeft = estimatedMinutesLeft + ":" + estimatedSecondsLeft;
- gSizeSample = loadedBytes;
- gSampleTimer = gCurrentTime - gStartTime;
- }
- fractionLoaded = loadedBytes / totalBytes;
- percentLoaded = Math.floor(fractionLoaded * 100) + "%";
- if(STREAM)
- {
- switch(PLAY_TYPE)
- {
- case "bytes":
- if(loadedBytes >= PLAY_BYTES)
- {
- if(!gPlaying)
- {
- _parent.play();
- gPlaying = true;
- }
- }
- break;
- case "frames":
- if(loadedFrames >= PLAY_FRAMES)
- {
- if(!gPlaying)
- {
- _parent.play();
- gPlaying = true;
- }
- }
- break;
- case "percent":
- if(fractionLoaded * 100 >= PLAY_PERCENT)
- {
- if(!gPlaying)
- {
- _parent.play();
- gPlaying = true;
- }
- }
- }
- }
- if(loadedBytes == totalBytes)
- {
- isLoaded = true;
- }
- if(isLoaded)
- {
- if(!STREAM)
- {
- _parent.play();
- }
- gLoading = false;
- stop();
- }
- }
-