Same preloader. sometimes go, sometimes no!

I’m using this code for a preloader and it works fine:

onClipEvent (enterFrame) {
_root.preloader.bar._xscale = siteLoaded;
siteLoaded = int((loaded_bytes/total_bytes)*100);
// bytes
total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
// frames
frame_loaded = _root._framesloaded;
frame_total = _root._totalframes;
// kilo bytes
totalkb = int(total_bytes/1024) add " KB";
loadedkb = int(loaded_bytes/1024) add " KB";
remaining_kb = int(remaining_bytes/1024);
remainingkb = int(remaining_kb) add " KB";
percent_done = int((loaded_bytes/total_bytes)100) add " %";
// time
time = getTimer()/1000;
// speed
speed = loaded_bytes/time;
bits = speed/1024;
Kbps = Math.round(bits
10)/10 add " KB/s";
// time remaining
kbyteCounter = (total_bytes-loaded_bytes)/1024;
loadRate = (loaded_bytes/1024)/time;
timeCounter = kbyteCounter/loadRate;
minutes = Math.floor(timeCounter/60);
seconds = Math.round((timeCounter/60-minutes)*60);
barra._xscale=int((loaded_bytes/total_bytes)*100);
time_remaining = minutes+":"+seconds+" s.";
// if (total_bytes == loaded_bytes) {
if (frame_loaded==38) {
_root.gotoAndPlay(2);
}
}

Then I try to import a intro movie inside a base movie at a point i called ‘anclaje’; and the intro preloader, with almost the same code, doesn’t
work good. This is the second preloader code:

onClipEvent (enterFrame) {
_root.anclaje.preloader.bar._xscale = siteLoaded;
siteLoaded = int((loaded_bytes/total_bytes)*100);
// bytes
total_bytes = _root.anclaje.getBytesTotal();
loaded_bytes = _root.anclaje.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
// frames
frame_loaded = _root.anclaje._framesloaded;
frame_total = _root.anclaje._totalframes;
// kilo bytes
totalkb = int(total_bytes/1024) add " KB";
loadedkb = int(loaded_bytes/1024) add " KB";
remaining_kb = int(remaining_bytes/1024);
remainingkb = int(remaining_kb) add " KB";
percent_done = int((loaded_bytes/total_bytes)100) add " %";
// time
time = getTimer()/1000;
// speed
speed = loaded_bytes/time;
bits = speed/1024;
Kbps = Math.round(bits
10)/10 add " KB/s";
// time remaining
kbyteCounter = (total_bytes-loaded_bytes)/1024;
loadRate = (loaded_bytes/1024)/time;
timeCounter = kbyteCounter/loadRate;
minutes = Math.floor(timeCounter/60);
seconds = Math.round((timeCounter/60-minutes)*60);
barra._xscale=int((loaded_bytes/total_bytes)*100);
time_remaining = minutes+":"+seconds+" s.";
// if (total_bytes == loaded_bytes) {
if (frame_loaded==1638) {
_root.anclaje.gotoAndPlay(2);
}
}

As you can see at his link:
http://www.niunpelodetonto.com/pablo/flash_esp/inicio/resolucion2.htm
Second preloader doesn’t works ok.

I supose there’s a little mistake on the code, but i have no idea where could be. Can you help me? Thanks!