A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Preloading.

  1. #1
    Junior Member
    Join Date
    Jun 2002


    ok, so Preloades.

    I get the Idear, find them great to look at and such, but where the hell do I put them in a movie!! Where in the timeline?? wht dodI do with them?? I need them to work so I can make a complete Flash site, (first one ), but I can't seem to make head nor tail of where to put them...

    Could someone point me in the direction of a HELPFUL tutorial about setting up prelaoders... that would be great.

    Thx ppl..


  2. #2
    Senior Member
    Join Date
    Feb 2001
    sweden, östersund

  3. #3
    Join Date
    Apr 2001
    Montréal, Québec.
    There are numerous point of views on preloaders, and a lot of tutorials out there, so here's my 2 cents worth!
    I allways prefer to have my preloaders in a seperate scene. You can thus easily insert one in a movie, make changes in it that won't affect other scenes, and more easily delete it, if it's on it's own rather than integrated to your first scene.
    A preloader is basicly a loop, minimily made up of 2 frames. I prefer 3 frames and will explain that later. A condition is checked on the first frame (are all the frames or all the bytes of the movie downloaded?), and if true the movie starts playing. Otherwise it moves on to the next frame where a goto, sends it back to the first frame until the condition is met. That's it!
    Here's a very basic preloader's actionscript. Supposing your movie is already done and you now want to add a preloader to it, first insert a new scene. Open up the Scene panel and rename your new scene preload or whatever, and make sure it's the first scene in the scene order, by dragging it on top of all the other scenes. Next go into editing mode of that preload scene. Rename the bottom layer actions, add 3 keyframes and type the following in them.


    Frame 1:

    if (_root.getBytesLoaded()>=_root.getBytesTotal()) {
    gotoAndPlay("Scene 1", 1);
    // You should replace "Scene 1" with your first scene's
    // name, if you've renamed it.
    // This first frame should allways remain clear of any
    // textfields and or animations, and is only used to
    // prevent seeing a flash frame of the preloader's elements
    // upon a refresh or a subsequent visit of your site.

    Frame 2:

    if (_root.getBytesLoaded()>=_root.getBytesTotal()) {
    gotoAndPlay("Scene 1", 1);
    // This is the frame that does it all on the initial
    // download of the movie. Once again change "Scene 1",
    // if you've renamed it.
    // This is also the frame where you would set and define
    // textfields' display scripts. None added for the moment!

    Frame 3:



    This basic preloader will work, but won't display anything as is. So add a second layer, and add 2 keyframes. Select your second keyframe (frame 2) and type in some static text message like "Loading... Please wait!". Make sure the text is but on frames 2 & 3, and that frame 1 remains a blank keyframe. My guess is probably that you eventually will want to add animations to your preloader (a loading bar,for example), and you should do it in the same manner. Add new layers, and make sure your the first frame is but a clear keyframe and that the animations only cover frames 2 & 3. Remember, that the more complex a preloader, the more time it may take for something to show up on the screen... To the point that if too complex or heavy on size, you may need to add a preloader to preload your preloader!
    Test your preloader by testing your movie and selecting "Show Streaming", under View.

    You can also have a look at this:


    And download the files here:


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center