13 Replies Latest reply on Aug 25, 2008 5:38 AM by omegamark

    Preload Problems

      I downloaded some Preloader code from a previous poster. (see below):

      <<<Here is the pre-loader i promised you.
      Dont get scared tho, its actually really short. I just added alot of comments in there to help you understand what is going on in the code. Plus added a progressBar and Stroke to give some visuals on loading length.

      place this code on Frame 1 of your _root timeline. and make your movie start from Frame 3. on all layers, make sure there is Nothing on frames 1 and 2. except the preloading code.

      Attach Code

      //******* Create progressBar and ProgressStroke ********\\
      this.createEmptyMovieClip("progressBar", this.getNextHighestDepth());
      progressBar.createEmptyMovieClip("progressStroke", this.getNextHighestDepth());

      //******* align progressBar on stage *****\\
      progressBar._x = Stage.width/2 - progressBar._xscale/2;
      progressBar._y = Stage.height/2;

      //******* draw progressBar stroke ******\\

      //******* pre-loader code ***********\\

      this.onEnterFrame = function(){
      //******* create progressText **************\\
      this.createTextField("progressText", 100, progressBar._x, progressBar._y+10, 300, 20);
      // this is the formula to get the persentage that is loaded
      // Math.round just rounds up the number to a whole. So there is no decimals in the number
      // bytesLoaded divided by bytesTotal times 100. this gives you the percentage.
      var loaded:Number = Math.round(this.getBytesLoaded()/this.getBytesTotal() * 100 );

      // here we draw a red line to represent the ammount that is loaded
      //lineStyle is how you want it to look like..
      //first number is the Thickness of the line
      //second is the hexadecimal value for the color
      //third is the alpha value of the line
      //moveTo simply moves the "pen", basically its where you want to start drawing from.
      // first the _x value, then the _y value
      //lineTo simply draws a line to the destination you specify.
      // we are using the variable loaded for the _x position, because we want it to represent how much it has loaded.
      progressBar.moveTo(0, 3);
      progressBar.lineTo(loaded, 3);

      //here we tell the text filed to display the variable loaded
      progressText.text = "Loading... "+loaded+"%";

      // here we check to see if it has fully loaded. If it has, then we move to frame 3.
      if(loaded == 100){
      delete this.onEnterFrame;

      I am fairly new to Flash and I am ussing Flash MX. I have been trying use it in the first 2 frames of my Flash movie, however, when I go to test it, I get the following:


      and then nothing happens. It just sits there with no progress happening. Am I doing something wrong?