6 Replies Latest reply on Aug 1, 2006 4:28 PM by Craig Grummitt

    Yet another preloader question

      I had posted a topic on here a few months ago regarding a preloader problem. I gave up on it for about a month and ahalf, but have since gotten most of it figured out. Basically, I have a preloader that is supposed to load a movie clip which dynamically displays images from a xml file. The images that I'm loading are attached to a movie clip. What I'm trying to do is preload the movie clips 'invisibly' so that all the images are actually loaded before they become visible. The problem that I'm having is that when I try to preload the images and clips it only preloads the movie clip, and not the image attached to it. I have a trace on bytes total and it only comes out to 38 bytes, which is considerably smaller than the images (around 39 kb). Any suggestions?
        • 1. Re: Yet another preloader question
          Craig Grummitt Level 3
          Yes Flash hasn't had a chance to begin loading the jpg and receive information about it eg. bytesTotal etc when you set totalBytes.

          If you have Flash MX 2004+, I recommend you have a look at the MovieClipLoader class. It comes with event handlers such as onLoadProgress that you can use to compare bytestLoaded with bytesTotal every time some more content has loaded.
          • 2. Re: Yet another preloader question
            Hecktic_Design Level 1
            Unfortunately I'm using FlashMX, so the movieClipLoader class is unavailable to me... SO there's really on way to fix this???
            • 3. Re: Yet another preloader question
              Craig Grummitt Level 3
              no no there's always a way, i was just pointing you in the direction of the easiest way.

              the first thing you need to do is check getBytesLoaded at regular intervals rather than in a loop on a frame. this can be achieved several ways - i've used setInterval in the example i prepared for you.

              the second thing you need to do is check that getBytesTotal has been received from the jpg okay - this can be checked by ensuring that getBytesTotal>4, which is the size of an empty movie clip.

              the code i have attached is independent of your xml code, which was really confusing things, as it is unrelated to your loader code (one problem at a time!). once you're happy with your loader code, then you can integrate it with your working xml code.

              good luck
              • 4. Re: Yet another preloader question
                WebXperience Level 1
                I could be wrong but in your code you seem to be loading all the images into just one variable. So that each time you loop through the for loop you are replacing the one which came before instead of creating an additional variable to hold the nect image for later retrieval.

                But like I said I could be wrong. It's late and I;m kind of seeing double but I don't see where you're applying the "i" to a new named variable or even an array.

                Your trace shows the different names coming in but you're slways using the same variable name.
                • 5. Re: Yet another preloader question
                  Hecktic_Design Level 1
                  Web - You are correct, I am loading the movie into the same movie clip, but i think it's irrelevant. I'm basically just trying to load them so that they are in the user's cache. In my actual movie I load each jpeg into the same movie clip that's used for a template, and that works fine, so I figured that it should work here also (I could be wrong).

                  Craig - Thanks for taking the time to write that up, I'll take a look at the code tonight. Once quick question. The commented line that says "insert fully loaded code here", are you referring to my xml code?
                  • 6. Re: Yet another preloader question
                    Craig Grummitt Level 3
                    no i'm referring to the graphic being fully loaded at that point so there may be specific actions you want performed - eg. remove the loader, start loading the next picture, play a song, who knows?