# Preloader causing variable problems

**URL:** <https://forum.kirupa.com/t/preloader-causing-variable-problems/346>\
**Category:** Uncategorized\
**Created:** [July 15, 2002, 1:14am UTC](https://forum.kirupa.com/t/preloader-causing-variable-problems/346 "2002-07-15T01:14:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pagongski](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@Pagongski](https://forum.kirupa.com/u/Pagongski)\
**Post date:** [July 15, 2002, 1:14am UTC](https://forum.kirupa.com/t/preloader-causing-variable-problems/346/1 "2002-07-15T01:14:25Z")

</div>

Hi,

I have a movie that works as a fashion photo colection, it has a photo at the left and a grid that when we click on it makes the photo move and give room to the next, it uses a few variables.  
The problem is, if i put a preloader on the flash, it doesnt work anymore, if i remove the preloader scene, it works, how can that be??  
Does having scenes ruin variables?  
The movie only has two scenes, the preloader is basic and shouldnt interfere with the rest of the movie, right? what could be wrong?  
In fact, the preloader is from this site, from david, i think.  
Would appreciate some help, thanks.

How can i check the variables states/values live while running the movie? Flash has a debug option that lists variables, but its not live.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 15, 2002, 1:35am UTC](https://forum.kirupa.com/t/preloader-causing-variable-problems/346/2 "2002-07-15T01:35:25Z")

</div>

what is the script on your preloader?

\_root.brian

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 15, 2002, 2:15am UTC](https://forum.kirupa.com/t/preloader-causing-variable-problems/346/3 "2002-07-15T02:15:52Z")

</div>

the code is simply this:

totalK = Math.floor(getBytesTotal() / 1024);  
loadedK = Math.floor(getBytesLoaded() / 1024);  
remainingK = totalK - loadedK;  
percentageK = Math.floor((loadedK / totalK) \* 100);  
if ((getBytesLoaded()/1024)\>=(getBytesTotal()/1024)&&(getBytesTotal()/1024)!=0){  
gotoAndPlay (3);  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 15, 2002, 3:04am UTC](https://forum.kirupa.com/t/preloader-causing-variable-problems/346/4 "2002-07-15T03:04:41Z")

</div>

I’ll start off by saying, I have no idea what is wrong with the code you posted. It seems right to me.

However, here what I do when In a “variable jam”.

I just create some dynamic boxes somewhere on the scene and I assign them the appropriate variable names. That way, it is LIVE and it helps a great deal when you’re not quite sure what is being loaded and what is not.

Good Luck!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 15, 2002, 5:00am UTC](https://forum.kirupa.com/t/preloader-causing-variable-problems/346/5 "2002-07-15T05:00:16Z")

</div>

hue… Tracing the variable is easier, Inigo… trace (variable), simply.

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 15, 2002, 2:15pm UTC](https://forum.kirupa.com/t/preloader-causing-variable-problems/346/6 "2002-07-15T14:15:22Z")

</div>

Use that its quite good but its configured to the normal stage sizes

if (!zInit) {  
createEmptyMovieClip(“mcBorders”, 2);  
createEmptyMovieClip(“mcProgress”, 1);  
mcBorders.lineStyle(2, 0x0000ff, 100);  
mcBorders.moveTo(25, 180);  
mcBorders.lineTo(25, 220);  
mcBorders.moveTo(525, 180);  
mcBorders.lineTo(525, 220);  
mcBorders.zInit = true;  
}  
\_root.nPercentLoaded = (\_root.getBytesLoaded()/\_root.getBytesTotal())_100;  
\_root.nXround = (Math.ceil(nPercentLoaded/20))20;  
mcProgress.beginFill(0xff0000,100);  
mcProgress.moveTo(25, 190);  
mcProgress.lineTo((nPercentLoaded5)+25, 190);  
mcProgress.lineTo((nPercentLoaded_5)+25, 210);  
mcProgress.lineTo(25, 210);  
mcProgress.endFill();  
if (\_root.nPercentLoaded\<100) {  
gotoAndPlay(\_currentframe-1);  
} else {  
removeMovieClip(\_root.mcBorders);  
removeMovieClip(\_root.mcProgress);  
}
