A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: best way to learn how about preloaders

  1. #1
    Member
    Join Date
    Feb 2003
    Posts
    34

    best way to learn how about preloaders

    hello from downunder,

    i am trying to insert a preloader into my index page which features incredibly modest use of flash but have not been able to get it to work.

    i have tried many types of preloaders, plug and play types etc. have done tutorials and built them only to have them not work when inserted into my flash index page - which does work.

    could anyone advise on the most efficient way of learning how to build/insert preloaders. i dont want to spend years learning this stuff just want to make it simple and get it finished.

    any advice appreciated
    ozdude

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Basically, a preloader is just a loop, that checks if a condition is met, and if so, instructs the movie to do something else than this looping.

    The easiest preloader... 2 frames at the beginning of your movie!

    Frame 1:

    if (_root.getBytesLoaded() >= _root.getBytesTotal()){
    gotoAndPlay(3); // Real start of the movie...
    }

    Frame 2:

    gotoAndPlay(1);


    This preloader will work but will not display anything. Displays have to be added on another layer, i.e. a "Loading" message movie clip, or textfields displaying bytes loaded or whatever, or even a progress bar based on the percentage of the movie that is already loaded...

  3. #3
    Senior Member Sir Yendor's Avatar
    Join Date
    Sep 2001
    Location
    Over here
    Posts
    1,140
    Does this preloader only measuer the bytes in the "root" movie or will it also measure, and wait for sub movies to be loaded as well?

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Asking me or ozdude?

  5. #5
    Senior Member Sir Yendor's Avatar
    Join Date
    Sep 2001
    Location
    Over here
    Posts
    1,140
    anyone who has the answer

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    If your referring to my script, no that wouldn't preload any external .swfs, loaded with a loadMovie action.

    The script would have to be altered, and work in conjunction with those movies own preloaders.

    In that case the pseudo code...

    frame1:

    loadMovieNum("first.swf", 1);
    stop();

    frame2:

    loadMovieNum("second.swf", 2);
    stop();

    Etc... Until all movies would be loaded.

    Then on the following frame, you would preload the main movie with:

    if (_root.getBytesLoaded() >= _root.getBytesTotal()){
    gotoAndPlay("main",1); // Real start of the movie...
    }

    Now, as I said this has to work in conjunction with the "to be loaded" movies' preloaders. Once the first movie has preloaded, it's preloader must stop it from playing, but also make the main preloader advance to the next frame, with _level0.nextFrame(); , where the next movie is then preloaded. When all movies have been preloaded, then a simple call from the main movie, with _levelx.gotoAndPlay(2); will have that movie play.

    Mind you, just realised that this could probably be done using a preloading code in each frame of the main movie's preloader, and when each preloading is done, the main movie is also simply moved to the next frame, where the same process is repeated.
    Last edited by oldnewbie; 02-04-2003 at 12:31 PM.

  7. #7
    Senior Member Sir Yendor's Avatar
    Join Date
    Sep 2001
    Location
    Over here
    Posts
    1,140
    This is great! Thanks for the code and thanks for explaining it.

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