View Full Version : preloader not loading fully
sandman9
06-04-2003, 05:54 PM
the attached preloader works fine except for the percentage. It does not go to 100% (but the loading bar loads fully). So when the preloader loads the percentage is only at like 77% or 80 something %, etc.
My script does says >= for bytes loaded so I'm stumped
Sandman9
sneeuwitje
06-05-2003, 09:42 AM
this just might solve it - calculations with numbers are much faster than with functions:
bytes_total = _root.getBytesTotal();
bytes_loaded = _root.getBytesLoaded();
if (bytes_loaded>=bytes_total) {
_root.gotoAndPlay("home");
} else {
percentloaded = math.round((bytes_loaded/bytes_total)*100);
// should be right without String(), but you never know
percent = String(percentloaded)+"%";
bar._xscale = percentloaded;
}
If not:
- try to trace 'bytes_loaded' and 'bytes_total' in a textField to see if any of 'm change where they shouldn't, or
- set the display to 'percentloaded' instead of 'percent' - maybe percent is used somewhere else too ... If that doesn't come up with 100 when the bar is full, there's funny things going on in your movie.
good luck!
farafiro
06-05-2003, 10:12 AM
it worked very well here for almost 5 times trials
sneeuwitje
06-05-2003, 10:32 AM
almost ...? What happened in the 5th?
yeah, i know. Here too.
But Sandman9's probably got something going on in scene 2, or preloader._parent we don't know about ... :confused:
sandman9
06-05-2003, 04:03 PM
I'm on a mac at work and there this attached file doesn't load fully ............. but i'm trying this exact same file here at home (on a PC) and it works fine.
Did any of you guys test out my attached file? If so did it work fine on your comps?
Thanks guys
Sandman9
sneeuwitje
06-05-2003, 05:29 PM
tested true on Mac OSX 10.2.6 && PC win2k with the very latest players
But when i tried to put it in a current project i work on all failed, but that's probably me :) (didn't try very hard yet).
sandman9
06-05-2003, 08:10 PM
if in the attached file it says go to next scene then it may not work with your other project. If you take out the command that says "nextscene ();" then it will work with your project.
Sandman9
sneeuwitje
06-05-2003, 09:13 PM
sandman9
This i did not quite get:
this attached file doesn't load fully .............
If you are 'attaching' (loading?) this swf you posted the fla of to just load this monkey-pic: You should not use _root.getBytesLoaded(), but this.getBytesLoaded() - and Total() ...
But that would be a bit of a funny way to dynamically load images - specially since MX can load JPEG and there's lots of really good pre-loaders available in this forum.
Hope this is not what you're doing here?:p
sandman9
06-06-2003, 05:29 AM
lol ......... no that pic is just for the purpose of having something to load :D
when I say not fully loading I mean the bar loads to the fullest but the percent that displays how much is loaded does not go to 100% ........ but here on my home comp everything works fine .... but at work it does not load to 100%
I'll try this instead of root tom at work and see if that helps
Sandman9
sneeuwitje
06-06-2003, 08:43 AM
'_root' or 'this' would be the same thing in that case, probably makes no difference then. still at a loss ...
sandman9
06-07-2003, 08:50 PM
so i uploaded the fla and explained the prob .... ummmmm ...... how weird
sandman9
06-09-2003, 08:36 PM
I have now taken the preloader out of scene one and put it into scene two (so there's no scenes used now). It is still giving me the same problem ... it loads to 97% or even 77% sometimes .... the bar is fine but the percent being displayed is doing this
Anyone had this same problem?
Sandman9
Fugee
06-09-2003, 08:56 PM
Working on a PC (Win XP) here...
tried it and it worked fine testing it with a debug speed of 56k, didn't quite work right with faster speed...tried changing the code in the first frame to this and it worked even at higher speed...
I don't know...maybe it's of some use..
percentloaded = (math.round(_root.getBytesLoaded() / _root.getBytesTotal() * 100));
percent = percentloaded + "%";
bar._xscale = percentloaded;
//bar._xscale = percentloaded;
if (_root.getBytesLoaded() >= _root.getBytesTotal()) {
_root.gotoAndPlay("home");
}
:confused:
this is weird behaviour :p
sandman9
06-09-2003, 09:27 PM
ahhhh this makes sense b/c it's rounding up and the gotoAndPlay command is listed before the calculating
Thanks
Sandman9
Fugee
06-09-2003, 09:36 PM
hehe, now you're telling i see ;)
true true, hope now it works fine!
sneeuwitje
06-09-2003, 09:43 PM
but a little explanation this thread could do with i suppose, as it's so obvious and we took so much time to figure it out ... :
In the old setting the movie was immediately sent "home" when conditions were met, before the display was set. In your new setting the "percentloaded" and "percent" are calculated before that.
I still prefer making getBytesLoaded() & --Total() variables on the very 1st enterFrame-line (c 1st post) and calculate with them, instead of querying 2 times, to rule out any time difference between 1st & last line of enterFrame. In this example it doesn't matter, but when enterFrame gets more more lines it will just make that difference.:)
sandman9
06-09-2003, 10:18 PM
It turned out to be a couple of things wrong wtih my preloader
1. shouldn't use a MC
2. shouldn't use scenes
3. shouldn't have the gotoAndPlay command before the calculations
Thanks guys for all your help
Sandman9
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.