Why does my preloader load prematurely?

I have this preloader code that should not play frame 3 until it is all loaded, but for some reason while my prelaoder bar is showing progess, frame 3 is already loaded. Can anyone tell me why? Here is my code below:

//frame 1:

bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent580;
this.loadText = Math.round(getPercent
100)+"%";
if (bytes_loaded == bytes_total) {
this.gotoAndPlay(3);
}

//frame 2:

gotoAndPlay(1);