# PreLoader Help Needed

**URL:** <https://forum.kirupa.com/t/preloader-help-needed/57505>\
**Category:** flash\
**Created:** [July 13, 2004, 8:25pm UTC](https://forum.kirupa.com/t/preloader-help-needed/57505 "2004-07-13T20:25:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deland01](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@deland01](https://forum.kirupa.com/u/deland01)\
**Post date:** [July 13, 2004, 8:25pm UTC](https://forum.kirupa.com/t/preloader-help-needed/57505/1 "2004-07-13T20:25:30Z")

</div>

Im needing assistance, I have the following script for my preLoader (see below). Its a simple preLoader with a loading bar that goes from left to right with a percent read out.

What I want is the percent text box to move along the [COLOR=Magenta]\_x[/COLOR] with the load bar, so when the load bar is at 100% the percent text box is just above.

Can anyone help??

[COLOR=Navy]myInterval = setInterval(preloader, 10);  
function preloader() {  
if (\_root.getBytesLoaded()\>=\_root.getBytesTotal()) {  
gotoAndPlay(nextScene);  
clearInterval(myInterval);  
}  
\_root.loadBar.\_xscale = (\_root.getBytesLoaded()/\_root.getBytesTotal())\*100;  
\_root.percentageDisplay.text = Math.round(\_root.getBytesLoaded()/\_root.getBytesTotal()\*100)+"%";  
}[/COLOR]

---

<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 13, 2004, 8:38pm UTC](https://forum.kirupa.com/t/preloader-help-needed/57505/2 "2004-07-13T20:38:53Z")

</div>

i’m not sure, but maybe try:

```auto

_root.percentageDisplay._x = _root.loadBar._width

```

but then again, you can’t manipulate the \_x property of a text field. so put it in a movie clip??

but you may get some lag time with the set interval…hmm…

oops. maybe i shouldn’t have responded. sorry.

---

<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 13, 2004, 8:44pm UTC](https://forum.kirupa.com/t/preloader-help-needed/57505/3 "2004-07-13T20:44:16Z")

</div>

right after the \_root.loadBar.\_xscale line put:  
\_root.percentageDisplay.\_x = Math.floor(\_root.getBytesLoaded()/\_root.getBytesTotal())\*loadBarFinalLength; //replace loadBarFinalLength with the number representing the width of the loadbar at 100%

That should move it along the x axis as the loadbar grows…just remember to put in the number or it won’t work  
Good Luck if you have other questions let me know
