View Full Version : [mx] movieClipLoader Progess Bar
greatbigbrain
November 23rd, 2004, 07:02 PM
Greets,
Has anyone successfully created a progress bar (or even a text field which displays the percentage loaded) which monitors the load progess of a movie clip loaded with MovieClipLoader?
I know we can use the getProgress method, but I'm struggling to apply it.
Any help would be appreciated.
Steve
Zeeman05
November 23rd, 2004, 10:21 PM
try this Action script for your pre load bar....
preloadBar.onEnterFrame = function () {
myBL = getBytesLoaded ();
myBT = getBytesTotal();
bytesLeft = myBT - myBL;
percent=Math.ceil((myBL/myBT) *100);
preloadBar.gotoAndStop(percent);
percentBox.text = percent +"% loaded";
if (percent>=100) {
gotoAndPlay(2);
//gotoAndPlay("video", 1)
}
else {
gotoAndStop(1);
}
milli = getTimer();
sec = Math.round(milli/1000);
//trace("Time elapsed is " + sec + " seconds");
//trace("There are " + bytesLeft + " bytes left to load out of " + myBT + " bytes");
}
This is set up to play a video at 90% loaded.
Youll need to put this on your scene with the preloader and it helps to add a layer with a stop action.
Your movie clip that will be loaded should be on a seperate scene.
Paste the AS into the right place and the variables will remain black, remember variables are made up words so i just used the ones in this AS, everything else will be blue except what is omitted will be gray.
Youll also need to set the instance name for this example the instance name in the movie clip preload bar, is preloadBar
percentBox is a dynamic text box i created where the actual text of the progress is recorded.
Im sure this makes no sense, but if you understand it try it.
And im sure there is an easier method this i just found easy.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.