Action Script - Preloader Percentage Counter
To be placed on a movie clip which contains either 100 frames or a dynamic text field named "percentNumber" or both. The movie clip should be on frame 1 of your movie. The script will then fill in the text with the percent loaded and move to the appropriate frame with in the clip. When 100 is reached the main movie will proceed to frame 2.
onClipEvent (load) {
total = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
loaded = _root.getBytesLoaded();
percent = int(loaded/total*100);
this.percentNumber.text = ""+percent+"%";
gotoAndStop(percent);
if (loaded == total) {
_root.gotoAndPlay(2);
}
}
|