dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: how do u make bar loaders that also show the percentage?

  1. #1
    Junior Member
    Join Date
    Mar 2002
    Posts
    11
    can someone please help me on how do u make bar loaders that also show the percentage?

    thank you

  2. #2

  3. #3
    Denim Demon
    Join Date
    Jun 2002
    Location
    Outside of society
    Posts
    514
    Oh, boy, fella-- you're asking a lot.
    I'm sure there are a bunch of tutorials on this, but I'm gonna help you out 'cause that's where my heart is today.
    Here's a process I've been using.
    1. put the contents of your movie on a keyframe a few frames later than frame one.

    2. create a label at the start of your contents. Something like "begin_movie" will do.

    3. create another label at the start of the timeline. Call it sometthing like "preload_loop."
    Now those labels should be a few frames apart.

    4. place these frame actions on an early frame, somewhere before "begin_movie":

    loadedBytes = _root.getBytesLoaded();
    totalBytes = _root.getBytesTotal();
    if (loadedBytes<totalBytes) {
    percentageOutput = int((loadedBytes/totalBytes)*100);
    _root.loaderBar._xscale = percentageOutput;
    gotoAndPlay("preload_loop");
    } else {
    gotoAndPlay("begin_movie");
    }

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Posts
    285
    I put this code on a box on the first frame stopped, with a little text box (xx) for the display:

    Code:
     
    
    onClipEvent (enterFrame) { 
    totalLoaded = math.floor((_root.getBytesLoaded()/_root.getBytesTotal())*100); 
    _root.xx = totalLoaded + "% of "+(math.floor( _root.getBytesTotal()/1024)) +"k Loaded "; 
    _xscale = (_root.getBytesLoaded()/_root.getBytesTotal())*100; 
    if (totalLoaded == 100) { 
    _root.play(); 
    } 
    this.gotoAndStop(totalLoaded); 
    } 
    onClipEvent (load) { 
    _xscale = 1; 
    }

  5. #5
    Denim Demon
    Join Date
    Jun 2002
    Location
    Outside of society
    Posts
    514

    further steps

    5. on the stage, create a dynamic text field and call it "percentageOutput" as I did.

    6. create a movie clip that contains a rectangle graphic to represent your progress bar. Call its instance "loaderBar."

    7. Set the progress bar's width to like 0 or 1 percent.
    The script will now update the text field and also stretch the progress bar.

  6. #6
    Junior Member
    Join Date
    Mar 2002
    Posts
    11
    thank you very much............
    .........such nice ppl.......
    ....

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