A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: preloader math, dammit....

  1. #1
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356

    preloader math, dammit....

    as stated earlier... dammit!

    Why cant i understand simple math?
    can someone debug my script for getting a preloader percentage?

    code:

    all = _root.getBytesTotal();
    got = _root.getBytesLoaded();
    perc = Math.floor((got/all)*100);



    that's as simple as it gets, but my percentage aint working....

    what have i done wrong? I've done thins a million times over, but it aint clicking tonight...

    thanks,
    -myk

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    It should!

    But why not use...

    percent = Math.floor((_root.getBytesLoaded()/_root.getBytesTotal())*100);

    For future reference... This is my 10200th post.

  3. #3
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356
    then maybe i'm screwing up with the progress bar...

    code:

    onClipEvent(enterFrame) {
    this._width = _root.perc;
    }


    this should work too, no?

    -myk

  4. #4
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356
    well, for some reason, she's holding steady at 7 percent.. It is two frames.... The progress bar is one keyframe one, with an extra frame on two.. Actions layer has a stop action on frame two.. Is this killing the onClipEvent?

  5. #5
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356
    i exhanged the stop action with an if-then statement, and it works now.. I would like to understnad why it didnt before, though..

    -myk

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    I'm more intrigued by the fact that you'd be using _root.perc while it hasn't been defined that way, in your first script?

  7. #7
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356
    that was defined earlier. The script in my first post is on the main timeline, first frame. It works now, though.

    Thanks

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