A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: preloading

  1. #1
    Junior Member
    Join Date
    Jan 2003
    Posts
    14

    preloading

    Hi guys and gals

    Ive made a preloader with a loadbar and percent and all that, and it works kinda fine, but when the movie starts, its just an empty screen for a while and then the preloader with the bar and all shows for maybe half a second, I want it to show from the get go, you know what I mean? This is the code I use

    percent=(_root.getBytesLoaded()/_root.getBytesTotal())*100;
    loader._xscale = percent;
    loadtext= int ((_root.getBytesLoaded()/_root.getBytesTotal())*100)+"%";

    "loader" is my loadbar of course.

    Am I doing this all wrong? I have the preloader in a scene all by itself before the "real" movie, which is in another scene

  2. #2
    try this
    under your bar make 2 dynamic text boxes and in the "Var:" box label them bytes and percent then try this code

    It makes an awesome preloader
    In a new layer labeled actions make

    Frame 1
    ---------------------------c-o-d-e----------------------------
    percent = "0%";
    bytes = "0 of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000
    + " Kb";
    ---------------------------------------------------------------

    frame 2
    ---------------------------c-o-d-e---------------------------
    percent = (Math.floor (_root.getBytesLoaded() / _root.getBytesTotal() *100) + "%");
    bytes = (Math.round((_root.getBytesLoaded() / 1024) * 1000) / 1000 + " Kb of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded.");
    if (_root.getBytesLoaded() == _root.getBytesTotal()) {
    percent = "100%";
    bytes = (Math.round((_root.getBytesLoaded() / 1024) * 1000) / 1000 + " Kb of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded.");
    gotoAndPlay("scene",frame);
    }
    ---------------------------------------------------------------

    Make sure you type in your own scene and frame in the last line above

    Frame 3
    -----------------------c-o-d-e---------------------------------
    gotoAndPlay(2);
    ---------------------------------------------------------------


    frame 4
    -------------------------------c-o-d-e-------------------------
    stop();
    ------------------------------------------------------------------

  3. #3
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    If you're using components or exporting stuff on the first frame (linkage from the Library), then your preloader will not display properly, or in fact won't display until all that has to be exported on the first frame is downloaded.

    You have to create a new preloader movie, which only purpose in life is to preload your present movie (without it's own present preloader), and you can find such a preloader in this thread:

    http://board.flashkit.com/board/show...hreadid=375161

  4. #4
    Junior Member
    Join Date
    Jan 2003
    Posts
    14

    thanx

    thanx ye olde newbie
    THAT was exactly what I was looking forpreloader".

    Thanx!

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