Skip to main content
Participating Frequently
August 2, 2006
Answered

preloader never stop hiting when it achive the percentage i want

it´s pretty simple, i have a preloader witch hits a certain function when it gets to the percentage
but the problems is that i have to make it just ONE hit per function, and it keeps hitting without stoping

here´s the preloader:


preloader_mc.onEnterFrame = function () {
total = _root.getBytesTotal();
loaded = _root.getBytesLoaded();
pct = (loaded/total) * 100;
pct = Math.floor(pct);

//HERE´s the whole problem:
if (pct >= 10 and pct < 30) {
loadlogo01 ();
}

if (pct >= 30 and pct < 50) {
loadlogo02 ();
}

if (pct >= 50 and pct < 70) {
loadlogo03 ();
}

if (pct >= 70 and pct < 90) {
loadlogo04 ();
}

if (pct >= 90) {
loadlogo05 ();
}

if (pct == 100) {
_root.gotoAndStop(2);
preloader_mc.unloadMovie();
}
}


so, it´s basically this:

for ex:

if (pct >= 70 and pct < 90) {
loadlogo04 ();
}

in this part of the code, the "loadlogo04 ();" function is supposed to just be called ONE time, but it´s calling several time whenever "pct >= 70 and pct < 90".

i want ALL functions to be called once.
This topic is closed to new replies. Start a new post to keep the conversation going.
kglad
kgladCorrect answer
Community Expert
August 2, 2006
try:

(and change your "and" to &&)

3 replies

kglad
Community Expert
Community Expert
August 2, 2006
you're welcome.
Translate
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
August 2, 2006
try:

(and change your "and" to &&)

Translate
leospitAuthor
Participating Frequently
August 2, 2006
kglad, thanks a lot!

i thought i had tryied with vars,

anyway, thanks a lot!!!

Translate