|
'Percentage Loaded' Preloader in Flash MX
Ever wondered how to make one of those percentage loaded counters on a Flash Movie? The one's that tell you what percent of the movie has loaded? Here's how:
[list=1][*]Add a blank keyframe at the beginning of your movie and name it Preload.[*]Name the frame which holds the first frame of your movie MovieStart.[*]Add a text field to the part of the page where you want your counter.[*]Set the properties of the text field to be a Dynamic Text Field[*]Set the variable field in the text box to say PercentLoaded.[*]Add this code to the keyframe containing your text field:
MovieSize = _root.getBytesTotal ();
LoadedSize = _root.getBytesLoaded();
PercentLoaded = LoadedSize / MovieSize * 100
if (PercentLoaded < 1) {
gotoAndPlay("Preload");
}
else {
gotoAndPlay("MovieStart");[/list=1]
Lines 5 and 8 of the code have tab spaces before them, but I couldnt do that in the thread...sorry.
Last edited by AndyMills; February 22 '04 at 01:20 PM.
|