Preloader doesn't work

I’ve tried to create a preloader in frame 1 which shows a small animation while the site loades. But it doesn’t work as it actually loads the entire site before showing frame 1 which kinda takes the idea out of the preloader.

This is my code:
[FONT=Courier New]stop();
addEventListener(Event.ENTER_FRAME, loading);
function loading(event:Event) {
var bytesloaded=stage.loaderInfo.bytesLoaded;
var bytestotal=stage.loaderInfo.bytesTotal;
if (bytesloaded>10&&bytesloaded>=bytestotal) {
removeEventListener(Event.ENTER_FRAME, loading);