Show % loaded?

I have made this loadthing that only shows the progress in percent,
but I only see 99% and 100%!
I’m not good at explaining, but I hope you get it :wink:

Here’s what I have done:

I have 3 keyframes, and in the third I have the clip itself with a stop(); actionscript.

In the first frame i have a dynamic text square that has the instant name ‘myOutput’.
The actionscript for that frame is:
percent = Math.floor(getBytesLoaded()/getBytesTotal()*100);
myOutput.text = percent + “% is loaded”;

In the second frame I just copied the text square, but I changed the actionscript to:
if (percent == 100){
gotoAndStop(3);
}else{
gotoAndPlay(1);
}

What did I do wrong? Thank you in advance!

is it getting to the third frame?

Prophet.

PS i just use the code in the kirupa tutorial… obviously i tweak it wen i need to but it works so i use it. simple.

EDIT:- wats the “math.floor” bit? wuldnt u rather round it? ive no idea wat flooring it does (in a mathmatical sense) but if its not gettin to the third frame id say its coz its reached a number which is just lower than 100 and therfore isnt a true %age value, hence its not meeting the final condition.

this on the first frame will give a truly bare bottom loader:

//setup variables for movie check
totalNum= _root.getBytesTotal();
loadedNum= _root.getBytesLoaded();

//calculate percentage loaded
percentage= loadedNum/totalNum*100;

//dynamic text box with instance name percentLoaded displays calculated value +"% Loaded"
percentLoaded.text= percentage + “% Loaded”;

if(loadedNum=totalNum){
gotoAndPlay(“3”)
}
else {play();
}

this is assuming you have a clip or something else on frame 3.

sam

:stuck_out_tongue: Floor IS rounding in a sense, it rounds down to nearest integer as opposed to ceil (ceiling) which rounds up. From the flash reference:

The floor is the closest integer that is less than or equal to the specified number or expression.

The ceiling of a number is the closest integer that is greater than or equal to the number.

:hr:

thanks maximum_flash! I’m gonna try that right now! :smiley:

EDIT:
It doesn’t work, but thanks anyway!

EDIT2:
Haha, it DOES work, i just mixed one thing up! thanks man!

EDIT3:
the third edit! :smiley:
This has the same problem,
it’s blank, blank, blank, blank, 100% loaded and then it pops up!
oh, by the way: Yes prophet, it’s getting to the third frame.

There’s probably alot of stuff in the first frame, hit ctrl+B to check;)

scotty(-:

even if that was the case (but it’s not :ogre: ), the loader would work right?

Post your fla:)

scotty(-:

ok… The attachment thing isn’t working for me, so i made a freewebs thing :smiley:

www.freewebs.com/dazov/about_me.fla

Btw! how do i make a scrollable text thing?
(so i can have more text about me on this page).

3 meg?? bloody hell i aint downloadin that!
wats on it?? i thout it was just a preloader?
blimey guvnor!!

Prophet.

PS ok this mite sound stupid but it mite be getting to 100% and imediately switchin to frame 3 before you see it. hav u got a dynamic text box on frame 3 to see if it actually gets to 100? coz if ur rounding it and your using the variable value then it mite be switchin too fast weras if u use getBytesLoaded() == getBytesTotal() then it should round to 100 before it actually gets there… try it, hav a look, u never know :wink:
PPS im on 56 k - y i aint downloadin it!! :wink:
PPPS uno thers a tutorials section with this stuff in right? its got about the “scrollable text thing” in ther… (basic version neway)

even if that was the case (but it’s not ), the loader would work right?

I think I wasn’t clear, when you test your movie hit ctrl+B and you would have seen this [SIZE=1](see attachment)[/SIZE]
You’re loading almost your complete movie on frame 1(except for 192 B) before the preloader can start working.

scotty(-:

ok, now im lost, how would that affect his % probs?

Prophet.

yea, the .fla file is like 3 times as big as the .swf file (when i export it).
And, i see “100% loaded” for like 1/10 of a sec before the actual page shows up, but i’ll have a look ;).

EDIT: and thanks scotty, i’m gonna try that as well!

welcome:thumb: