A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: preload problem...

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

    preload problem...

    I have been trying to use this preloader
    It is one of those ones that is in a seperate swf that forwards the user onto the main swf when it is loaded.
    It kind of works but the dynamic text box displays NAN or something like that at the begining of the load which looks bad.
    I have attached the FLA and here is the code on frame one
    Thanks a lot for any help
    m

    // Hides displayed elements
    this.reelmc._visible = false;
    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("leechildweb9.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;
    this.reelmc._visible = false;
    percent_display = "";
    this.loadbar._visible = false;
    loadMovieNum("leechildweb9.swf",0);
    }
    }
    stop();
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    Aug 2005
    Posts
    79
    updated - it works now

    OK, there seem to be an extra set of "else {" and "}" (lines 41 & 43) that once removed, the % loaded and the progress bar will then work.
    Code:
    }   //*********edited out*******   else {
         //      trace("0% loaded");
         //*********edited out******* }
        if (percent == 100){
    pls see attached

    hth
    Attached Files Attached Files
    Last edited by green.apple; 04-08-2006 at 04:33 AM.

  3. #3
    Senior Member
    Join Date
    Feb 2002
    Posts
    166
    Thank you very much

  4. #4
    Senior Member
    Join Date
    Feb 2002
    Posts
    166
    Still does the NaN thing for me when it loads I'm afraid...

    Any other thoughts

    thanks
    m

  5. #5
    Member
    Join Date
    Aug 2005
    Posts
    79
    i've seen that NaN thing before when the incorrect timeline was being targetted (e.g. when "this" should have been used instead of " _parent" or something similar when the movie goes "up" one level too high.)

    i didn't see that when i tested your .fla which uses "this". just out of curiousity, are you using this preloader inside another .fla? (although i'm not sure if that would be the reason why you're seeing "NaN" instead of the actual % loaded)

    also, does the leechildweb9.fla have a blank first frame?
    Last edited by green.apple; 04-08-2006 at 07:46 AM. Reason: edit for clarity

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