A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: preloader not working please help

  1. #1
    Member
    Join Date
    May 2003
    Location
    NC, USA
    Posts
    48

    preloader not working please help

    This is my preloader AS:

    bytes_loaded = Math.round(this.getBytesLoaded());
    bytes_total = Math.round(this.getBytesTotal());
    getPercent = bytes_loaded/bytes_total;
    this.loadBar._width = getPercent*300;
    this.loadText = Math.round(getPercent*100)+"%";
    ifFramesLoaded(50);
    // change number down to make movie start faster
    this.gotoAndPlay(4);

    When I test the site www.xpertintl.com it does not show the preloader. Can someone see anything wrong with my script?

    Thanks,
    gala

  2. #2
    Living Proof mave_the_rave's Avatar
    Join Date
    May 2002
    Location
    East Dulwich
    Posts
    1,006
    Hi..
    Not sure if this quite right as I tried to adapt one of
    my preloaders.

    bytes_loaded = this.getBytesLoaded();
    bytes_total = this.getBytesTotal();
    getPercent = bytes_loaded/bytes_total;

    this.loadBar._width = getPercent*300;

    loadText = Math.floor(getPercent*100)+"%";

    ifFramesLoaded(50);
    //change number down to make movie start faster
    this.gotoAndPlay(4);
    If someone tells you it can't be done,
    it's probally because they don't know how.

  3. #3
    Member
    Join Date
    May 2003
    Location
    NC, USA
    Posts
    48
    the preloader is still doing the same thing, any more ideas on how to fix this?

  4. #4
    Living Proof mave_the_rave's Avatar
    Join Date
    May 2002
    Location
    East Dulwich
    Posts
    1,006
    Ok, try:-

    this.loadBar._xscale = getPercent*300;

    instead of

    this.loadBar._width = getPercent*300;
    If someone tells you it can't be done,
    it's probally because they don't know how.

  5. #5
    Member
    Join Date
    May 2003
    Location
    NC, USA
    Posts
    48
    I think that works, but I don't see the load bar moove or the % loaded change. Do you have any ideas of what I may have done wrong?

    www.xpertintl.com/inprogress

    Thanks,
    gala

  6. #6
    Living Proof mave_the_rave's Avatar
    Join Date
    May 2002
    Location
    East Dulwich
    Posts
    1,006
    Hi

    The action for the bar to move needs to be in a loop like this:-

    MovieSize = _root.getBytesTotal();
    LoadedSize = _root.getBytesLoaded();
    PercentLoaded = LoadedSize / MovieSize
    percent = Math.floor(PercentLoaded*100);
    showPercent = percent + " %";

    _root.growbar._xscale = percent

    if (PercentLoaded < 1) {
    gotoAndPlay("preload");
    }
    else {
    gotoAndPlay("moviestart");

    }
    Where 'preload' is a lable in the first frame of preloader
    and 'moviestart' is a label in the first frame of your movie proper.
    If someone tells you it can't be done,
    it's probally because they don't know how.

  7. #7
    Member
    Join Date
    May 2003
    Location
    NC, USA
    Posts
    48
    what do you think of this:

    bytes_loaded = Math.round(this.getBytesLoaded());
    bytes_total = Math.round(this.getBytesTotal());
    getPercent = bytes_loaded/bytes_total;
    this.loadBar._width = getPercent*100;
    this.loadText = Math.round(getPercent*100)+"%";
    ifFramesLoaded(50);{this.gotoAndPlay("Home",4);}
    if (bytes_loaded == bytes_total)
    {this.gotoAndPlay("Home",4);}

    what I am trying to do is have the 50% of the movie loaded and playing while the rest of the movie loads. The problem with this is the % loaded text box does not change.

    thanks,

    gala

  8. #8
    Living Proof mave_the_rave's Avatar
    Join Date
    May 2002
    Location
    East Dulwich
    Posts
    1,006
    Hi..
    bytes_loaded = Math.round(this.getBytesLoaded());

    ifFramesLoaded(50);


    You are checking for BytesLoaded then using

    ifFramesLoaded(50);

    in your case try:-

    if (getPercent > .5 ){
    this.gotoAndPlay("Home",4);
    }

    Hopes this helps. I'm off out now until tomorrow.
    I'm not that good myself at all this. There are a lot of much
    better people out there. Hope they pick up on this for you.

    mave_the_rave.
    If someone tells you it can't be done,
    it's probally because they don't know how.

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