Masking Preloader

Hey,

Just making a site, and started putting the preloader together. Rather than have the traditional ._x of the bar according to the percent, i wanted to mask something over 100 frames…

there is a movieclip revealing itself over 100 frames, and here is the code i placed on it in the root, frame 1 of the timeline


onClipEvent (load) {
	total = _root.getBytesTotal();	
}
onClipEvent (enterFrame) {
	loaded = _root.getBytesLoaded();
	percent = int(loaded / total * 100);
	text = ("Loaded " + percent) + "%";
	gotoAndStop(percent);
	if (loaded == total) {
		_root.gotoAndPlay(3);
	}//end if
}//end enterFrame

Then on frame 2 onwards the animations start, like the loader fading out, site moving in etc…

It loads it fine, but once it reaches the full length of the bar, it doesn’t go and play the animation.

I also delcared the variables


	var loaded:Number = 0;
	var total:Number = 0;
	var percent:Number = 0;

Thanks to any suggestions! :thumb: