Fade out preload bar when loaded!

I would like to create a preload bar that fades out when the content is loaded. Here is the code I have so far, it works ok but the fade out is too long. I’ve tried tinkering with the code further, but it starts to fade out half way through.

onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)100)).25;
per = int(percent);
percentage = per+"%";
loadBar._width = per*4.5;
if (percent>100&& _this._alpha <= 20) {
this._alpha -=1;

Any help greatly appreciated!

I would just use a tween to fade it out then. Use an if condition to check if it has loaded then a gotoAndPlay command which then plays your fade out animation.