A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: displaying percent loaded in preloader

  1. #1
    Join Date
    Aug 2000
    if (Number(_framesloaded)>=_totalframes) {
    gotoAndPlay ("loaded");
    } else {
    setProperty ("loader", _xscale, (_framesloaded/_totalframes)*100);

    i use the above script in a preloader scene and it works great.

    i want to have the pecentage loaded displayed on the screen. i know how to display a dynamic variable, but how do i create the variable to display. IOW, how do i set a variable equal the the percentage loaded? i tried displaying the value of "loader", but it didn't work. i am stumped. i even tried creating a new variable "percentloaded" and set it to: (_framesloaded/_totalframes)*100. any ideas? thanx.

  2. #2
    Now listen heah! Mac8myPC's Avatar
    Join Date
    Aug 2000
    Steve Job's Doorstep
    i think this is the right equation for displaying the percent with _framesLoaded:

    percent = Math.round(100/(_root._totalFrames/_root._framesLoaded))

    then you could say:

    if (percent == 99 ) { _root.play() }

    or something like that.

    i use the math.round function because it rounds the number for display in the dynamic text field automatically - in this case it would be named "percent"

    i hope that helps!

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