A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: Preloader doesn't appear until 50% done...

  1. #1
    Senior Member
    Join Date
    Feb 2002
    Posts
    272

    Preloader doesn't appear until 50% done...

    Anyone know why this is? I have a scrollpane in my movie and someone told me a while back that it might account for this problem. Well, I took it out and nothing changed. Can anyone help me out? thanks!
    ------
    code for preloader:
    frame1-

    totalBytes = this.getBytesTotal();
    loadedBytes = this.getBytesLoaded();
    remainingBytes = totalBytes - loadedBytes
    percentDone = int((loadedBytes/totalBytes)*100);
    bar.gotoAndStop(percentDone);
    if (_framesloaded == _totalframes) {
    gotoAndPlay(3);
    }

    frame2-

    gotoAndPlay(1);
    -------

    everything is setup properly from what I can tell, but maybe this is a problem others have run into and there is a specific reason? thanks!
    Woody

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Either the graphics in the preloader take 50% of the total kb or you use components or attached movies within your movie. They always load first, even before the preloader.

    Did you also delete the scrollpane from the library ?

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Senior Member
    Join Date
    Feb 2002
    Posts
    272
    I do have some loadmovie commands in the main timeline. And no, I didn't delete the components from the library. How would I setup the loadmovies so that they are loaded when they are actually called in the timeline and not when the timeline itself loads? thanks a bunch!
    Woody

  4. #4
    Senior Member
    Join Date
    Jan 2005
    Posts
    110
    You have to delete the component from the library, otherwise, it still takes size in the first frame. Really frustrating.

    For the loadMovie(), simply put on the timeline and it will run when flash plays on the timeline.

  5. #5
    Senior Member
    Join Date
    Feb 2002
    Posts
    272
    Originally posted by zhenjyu
    For the loadMovie(), simply put on the timeline and it will run when flash plays on the timeline.
    Alright, that's what I have right now. So it doesn't load that movie before playing it right? Let me try taking the component out of the library and seeing if that helps. Thanks
    Woody

  6. #6
    Junior Member
    Join Date
    Feb 2005
    Location
    S.F. CA
    Posts
    7
    sounds like your preloader is too large.. make it light like arround 10k or less

    volkswagens kill people!

  7. #7
    Senior Member
    Join Date
    Feb 2002
    Posts
    272
    oh, it's tiny, just a basic bar preloader. it's not the preloader... I put the same preloader in a test movie and it worked fine, but for some reason, it won't display here. I've taken out all of my loadmovie actions and components, but to no avail. It STILL lags. I guess it's hard to determine what's going on through the info I've given but what I'm really hoping for is someone that's had a similar problem and may know how to fix it. I'm loading in a lot of pic sequences and image files. Could that be it?
    Woody

  8. #8
    Senior Member
    Join Date
    Feb 2002
    Posts
    272
    AH HA! Ok, making progress. I had a jpeg sequence with 75 frames that after I deleted from my library, the preloader now displays starting at 30%. I guess I'm confused as to why having so many images would interfere with the preloader being displayed. Anyone have any ideas? (I don't want to delete every outside image just to get my preloader to work.. that doesn't seem to make much sense) thanks
    Woody

  9. #9
    Registered User
    Join Date
    Mar 2001
    Posts
    34
    Really sounds like a component issue that I have had in the past. components export to the first frame of your movie and load before everything else. - even your preloader. Here is how I have been working around this issue. Create a new FLA that is the same size as the .swf that you want to load. Name it preloader On the first keyframe of preloader add loadbar with and instance name of "loadbar" and a dynamic text feild with an Var name of "percent_display"

    also add this actionscript to the first keyframe of preloader.fla

    read the comments within the actionscript which describe what it is doing

    code:


    /* First thing to do is set the stage size of
    this movie at the same size as your
    "to be loaded" movie, and re-position the display
    elements to your liking.
    Also set the same framerate as your movie.
    Then replace "YourFlash.swf" in 2 of the lines below,
    with the name of your movie.
    Last, make sure your present movie is cleared
    of any preloader, and most importantly, that it
    starts off with a first blank keyframe.
    */

    // Hides displayed elements

    this.loadbar._visible = false;
    percent_display = "";
    //create a new movieclip to load
    //the external movie into
    this.createEmptyMovieClip("container",10);
    //load the external movie into the new movieclip
    container.loadMovie("YourFlash.swf");
    //check the download status of the external
    //movie once every frame
    this.onEnterFrame=function(){
    //trace the percentage of the movie that has loaded
    percent=(this.container.getBytesLoaded()/this.container.getBytesTotal())*100;

    if(!isNan(percent)){
    // trace(percent+"% loaded");
    if (percent == 0) {
    percent_display = "";
    } else {
    percent_display = Math.ceil(percent) + "% LOADED.";
    }
    this.loadbar._visible = true;
    this.loadbar._xscale = percent;
    if (percent > 1) {
    this.reelmc._visible = true;
    }
    container.stop();
    } else {
    // trace("0% loaded");
    }
    if(percent == 100){
    delete this.onEnterFrame;

    percent_display = "";
    this.loadbar._visible = false;
    loadMovieNum("YourFlash.swf",0);
    }
    }
    stop();



  10. #10
    Senior Member
    Join Date
    Feb 2002
    Posts
    272
    ahh, I know what you're saying, but I tried and can't get it to work... are my files wrong?
    Woody

  11. #11
    Senior Member
    Join Date
    Feb 2002
    Posts
    272
    here's the file i'm trying to have shown preloading.. and yes, there is a blank key frame in the first frame.
    Woody

  12. #12
    Member
    Join Date
    Nov 2004
    Location
    London, Covent Garden
    Posts
    78
    I think sound is another reason preloaders start late.
    bosie

  13. #13
    Senior Member
    Join Date
    Feb 2002
    Posts
    272
    can anyone point me to a tutorial on how to create an external preloader? thanks
    Woody

  14. #14
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    The code posted by Dickson is mine and works fine (except your loadbar which you've tampered with...) when I load my own movie. Tried to run your pagetest3.swf, but it seems to have no content...
    Can you make the .fla available, so I can have a look at your setup?

  15. #15
    Senior Member
    Join Date
    Feb 2002
    Posts
    272
    well, i COULD, but I'm a little confused. The flash movie only contains a 100 kb mp3 file, nothing else... but it's 2.7 mb in size! after putting it into a zip, it's 2.1 mb. I'm really confused. If I can figure out why it's so big, I can compress it and make it available. hmmm....
    Woody

  16. #16
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Oh! Didn't realized it was only a sound file, didn't have my speakers opened... Let me check it again...

  17. #17
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Well after correcting your loadbar bit, it works fine for me...

    Have a look... Of course it's only a 57KBs sound movie, so on a fast connection it loads pretty fast. I've also coded it so that it appears on each test (on a refresh or re-load...), rather than using the cached file, just so that you could always see the preloader in action...

    http://blake.prohosting.com/~tektips.../preloader.swf

  18. #18
    Senior Member
    Join Date
    Feb 2002
    Posts
    272
    haha, is there anyway you could share HOW you fixed it? thanks newbie
    Woody

  19. #19
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Fixed what? I didn't change anything except the loadbar bit, and that didn't have any effect on the preloading code itself...

    Note that you can't really test this thing locally. You need to upload it online to test it... And as I said, it was originally designed to not show up when the file is already cached.

  20. #20
    Senior Member
    Join Date
    Feb 2002
    Posts
    272
    you said you "corrected" it, I was just wondering what was "wrong." thanks anyway
    Woody

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