Preloader for webpage

hello all,

I am totally newbie and… most likely my question will be very simple for you… :cubs:

I obtain this code for preloader (I don’t kno if there is anything newer or better):

loadedBytes = _root.getBytesLoaded(); 
totalBytes = _root.getBytesTotal();  
if (loadedBytes < totalBytes){ 
percentageOutput = int((loadedBytes /  totalBytes) * 100); 
_root.loaderBar._xscale = percentageOutput;  
gotoAndPlay("preload_loop"); 
} 
else{ 
gotoAndPlay("begin_movie");  
} 

As I understood I put my file. swf where the preload_loop is. Correct?
BUT where/how do I place the code so my file.swf stops when my index.php is loaded and ready to be displayed?

Thank you