What if percentage doesn't increase with 1 every frame? That if statement will then miss sometimes.

You could do something like:


var oldPercentage = 0;

//then in update loop
if (Math.floor(percentage/10) != oldPercentage) {
    trace("Another 10% loaded");
    oldPercentage = Math.floor(percentage/10);
}


Not the nicest solution but at least it works.

/Andreas


Adrian Lynch wrote:
How about...

if ( percentage % 10 == 0 ) {
        trace("Another 10% loaded");
}

Ade

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Matt Ganz
Sent: 16 November 2005 21:31
To: Flashcoders mailing list
Subject: [Flashcoders] tracing every 10% of loading files


hi.

hopefully this question isn't too newbie.

i'm loading a bunch of external swfs and i am trying to determine what
percentage of 'totalWeight' is 'currentWeight'. here's my equation:

var percentage = (currentWeight/totalWeight) * 100;

i believe that's fine. but my question is how can i express the following:

"for every increase of 10%, up to 100%...." // trace( "another 10% loaded" )

thanks. -- matt.

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to