Preloader, PLEASE HELP

I can never figure out why these things don’t work, this is my code and to me in theory this should work.

onClipEvent (enterFrame) {
totalBytes = _root.getBytesTotal;
loadedBytes = _root.getBytesLoaded;
remainingBytes = totalBytes-loadedBytes;
if (loadedBytes < totalBytes && loadedBytes >=0) {
loaded = int((loadedBytes/totalBytes)*100);
_root.preloaderbar._xscale = loaded;
} else if (loadedBytes == totalBytes) {
Can someone please help me with this because I can’t figure it out.

preloaders are :evil: