Categories

Partners
  • Website Templates

  • Design Feeds

  • Adobe Photoshop Tutorials

  • Website Templates, WordPress Themes

  • Website Templates

  • Flash Web Sites

  • Photoshop Templates

  • Photo Contests

  • Photo Tips
  • Search


    Advanced Search


    Partner Links
  • Adobe Photoshop Tutorials

  • Free Stock Photos and Images



  • Website Templates

    Loading Additional Content
    Published  09/30/2006 | Macromedia Flash
       




    Loading Additional Content

    If you want to reuse this preloader to load additional content once the user is in the site, all you have to do is make sure the preloader movie clip, or another preloader clip also registered to the Preloader class, is on the Timeline, and call the startLoad method with the parameter being the movie clip that the new movie will be loaded into.

    Loading Multiple Files as Part of the Initial Load

    For most of the sites that I build, it is necessary to load multiple files as part of the initial site load. This makes things a little bit trickier. The Preloader class could be extended by modifying the checkLoadProgress method so that it can accommodate multiple files.

    When checking the load of multiple files, it is not a good idea to get a grand total by adding the result of getBytesTotal and getBytesTotal on all of the clips being loaded. I have noticed that Flash will only load three or four external files at once, and the getBytesTotal method will not return the proper value until a clip has started loading. For example, if you are loading five SWF files at once, and try to get a total bytes value in this way, you will only get the totals for the first three that start loading. As soon as one finishes, another will start loading, making your total value change, which will change the result of the percent loaded calculation. You will end up with an inaccurate loading animation.

    Here are a couple of options for showing progress of multiple file loads:

    • Have a separate progress animation for each file.

    • Hard code the total bytes of the files.

      The total bytes could be passed to the preloader when startLoad is called, and the loaded bytes would still be retrieved with getBytesLoaded called on each of the clips being loaded. This results in smooth and accurate preloader behavior. However, the drawback is that you have to update the total bytes value in the code every time any of the files is changed.

    • The progress animation could be based on how many files have loaded. Instead of showing the percentage of bytes loaded, the animation could show the percentage of files loaded.

    You will have to experiment with these methods and decide which works best for your situation.

    Article Series
    This article is part 4 of a 4 part series. Other articles in this series are shown below:
    1. Building Preloaders and Progress Bars in Macromedia Flash
    2. What to Think About When Designing Your Preloader
    3. Putting Theory into Practice: An Example
    4. Loading Additional Content