# Problems with preloader code

**URL:** <https://forum.kirupa.com/t/problems-with-preloader-code/208524>\
**Category:** Uncategorized\
**Created:** [November 29, 2006, 5:28pm UTC](https://forum.kirupa.com/t/problems-with-preloader-code/208524 "2006-11-29T17:28:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navarone](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Navarone](https://forum.kirupa.com/u/Navarone)\
**Post date:** [November 29, 2006, 5:28pm UTC](https://forum.kirupa.com/t/problems-with-preloader-code/208524/1 "2006-11-29T17:28:34Z")

</div>

In the following code I set my preloader to play an swf. If I test the preloader inside or outside the flash author environment it plays the swf. If I change the swf to a new file name and resave the flash file with a new name it won’t play the new swf. I can’t figure out whats going on. I am using FlashMX 2004 Prof.

```auto

/* First thing to do is set the stage size of 
   this movie at the same size as your 
   "to be loaded" movie, and re-position the display
   elements to your liking.
   Also set the same framerate as your movie.
   Then replace "YOUR.swf" in 2 of the lines below, 
   with the name of your movie.
   Last, make sure your present movie is cleared 
   of any preloader.
*/
// Hides displayed elements
this.reelmc._visible = false;
this.loadbar._visible = false;
percent_display = "";
//create a new movieclip to load
//the external movie into
this.createEmptyMovieClip("container",10);
//load the external movie into the new movieclip
container.loadMovie("Culture_History.swf");
//check the download status of the external
//movie once every frame
this.onEnterFrame=function(){
    //trace the percentage of the movie that has loaded
    //trace(percent);
 percent=(this.container.getBytesLoaded()/this.container.getBytesTotal())*100;
 if(!isNaN(percent)){
  if (percent == 0) {
   percent_display = "";
  } else {
   trace(percent);
   percent_display = Math.ceil(percent) + "% LOADED.";
  }
  this.loadbar._visible = true;
  this.loadbar._xscale = percent;
  if (percent > 1) {
   this.reelmc._visible = true;
  }
  container.stop();
    }
    if(percent == 100){
  delete this.onEnterFrame;
  this.reelmc._visible = false;
  percent_display = "";
  this.loadbar._visible = false;
  loadMovieNum("Culture_History.swf", 0);
 }
};
stop();

```
