PDA

View Full Version : Stumped with preloader



ultraloveninja
September 27th, 2005, 03:36 AM
well, i'm stumped.
i can't get this preloader to work. i test it out, and it hangs.
i've tried to change my _root to _parent values and nada. it just shows 0% and does nothing.
here's the AS that i am using:


onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndStop(2);
}
}


i got it off a tutorial a while ago. it seems to work in other flash movies that i have created, but not on this one. i've even re-built it from scratch, and still nada.

anyways, and suggestions would be great. i think it's just that i am tired and i can't find my err.
thanks.

nathan99
September 27th, 2005, 05:22 AM
one question....




percent -= (percent-((loading/total)*100))*.25;



where are you setting percent before your you try subtracting from it?

ultraloveninja
September 27th, 2005, 08:04 AM
huh?

i saw that, but i am not sure as to what that was previously.

nathan99
September 27th, 2005, 08:16 AM
try like....


onClipEvent (load) {
percent=0;
}
onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndStop(2);
}
}

or


onClipEvent (load) {
percent=100;
}
onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndStop(2);
}
}

ultraloveninja
September 27th, 2005, 09:44 AM
ah...gotcha.
yep. that did it.
weird. i don't think i had to do that before.
oh well, thanks for your help! :)