Circle filling preloader....?

Hi All! Well once again in dire straits… Im trying to do a preloader that I have seen several times on other sites. I wonder if they just copy it from somewhere cause this is ridiculously hard!

Well what I want to do is this circle that fills up according to how the movie preloads. (The drawing code thanks to scotty) Its like a clock and when it is full it is a big filled circle. Ok well I am able to make it stop and play whenever the movie is loaded, but what I cant do is make it fill up according to the porcentage of loaded bytes. I will explain at the end of the following AS:


stop();
r = 100;
a = 0;
x = Stage.width/2;
y = Stage.height/2;
c = _root.createEmptyMovieClip("circle", 1);
c.onEnterFrame = function() {
	this.beginFill(0xFF0000, 100);
	this.moveTo(x, y);
	this.lineTo(x+Math.sin(a*Math.PI/180)*r, y-Math.cos(a*Math.PI/180)*r);
	this.lineTo(x+Math.sin((a+5)*Math.PI/180)*r, y-Math.cos((a+5)*Math.PI/180)*r);
	this.lineTo(x, y);
	this.endFill();
	frloaded = _root.getBytesLoaded();
	frtotal = _root.getBytesTotal();
	b = int((frloaded / frtotal) * 100);
	percentloaded = int((b*355)/100);
	trace(percentloaded);
	a += 5;
	if (percentloaded >= 355) {
		delete this.onEnterFrame;
		_root.circle.removeMovieClip();		
		_root.play();
	}
};

OK NOW: percentloaded is a ratio, so if b (percentage of movie loaded) is 100 then percentloaded variable is 355, if b is 50, then percentloaded is 177.5. So thats how I can say //if percentloaded >= 355 (a full circle) then erase that mc and go play the movie…

My problem is this. As you can see, if the movie is only 5 k or something, then of course the value of a isnt incremented how it should be, the circle isnt full! It only has a little piece there. I need to increment a according to how the percentloaded is. I tried putting a+=percentloaded; but since the actual drawing is declared before that, and the if statement which makes the movie play is right after it, of course that new value of a will never have its turn to be applied! I dont even think that would be the best way to do it anyway, and now that I think about it it wouldnt haha Does anyone have any ideas? Are the entire logistics wrong, or am I on the right track? Thank you very much for all your help once again!

Ted