# Preloader % question

**URL:** <https://forum.kirupa.com/t/preloader-question/42151>\
**Category:** Uncategorized\
**Created:** [February 5, 2004, 7:42pm UTC](https://forum.kirupa.com/t/preloader-question/42151 "2004-02-05T19:42:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielthelion](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@danielthelion](https://forum.kirupa.com/u/danielthelion)\
**Post date:** [February 5, 2004, 7:42pm UTC](https://forum.kirupa.com/t/preloader-question/42151/1 "2004-02-05T19:42:04Z")

</div>

hey guys, im sure theres been numerous questions about this, but i couldnt find a string that addressed my particular question.  
im trying to get my % # to move along the \_X axis with my preloader bar. any suggestions?

---

<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:** [February 5, 2004, 11:48pm UTC](https://forum.kirupa.com/t/preloader-question/42151/2 "2004-02-05T23:48:37Z")

</div>

just move the text.\_x with the preload \_x or put the text in a MC and move that MC’s \_x … not sure if u can move a text\_x

---

<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:** [February 6, 2004, 1:24am UTC](https://forum.kirupa.com/t/preloader-question/42151/3 "2004-02-06T01:24:37Z")

</div>

Give this code a go

[AS]  
\_root.onEnterFrame = function()  
{  
var totalBytes = \_root.getBytesTotal();  
var loadedBytes = \_root.getBytesLoaded();  
var percentComplete = (loadedBytes - totalBytes) \* 100;

```
if (percentComplete &gt;= 100) gotoAndPlay(nextScene());

myBar._xscale = percentComplete;
myText._x = percentComplete;

```

}  
[/AS]  
myBar would be the instance name of your loading bar and myText would be the instance name of your dynamic or input text box.

Cheers

---

<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:** [February 6, 2004, 7:22pm UTC](https://forum.kirupa.com/t/preloader-question/42151/4 "2004-02-06T19:22:54Z")

</div>

Shouldn’t this line:

```auto

var percentComplete = (loadedBytes - totalBytes) * 100;

```

read

```auto

var percentComplete = (loadedBytes/totalBytes) * 100;

```

? 😉

---

<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:** [February 6, 2004, 7:31pm UTC](https://forum.kirupa.com/t/preloader-question/42151/5 "2004-02-06T19:31:14Z")

</div>

The basic equation for something like this goes like…

loadPercentClip.\_x = loadBarClip.\_x+loadBarClip.\_width

This will move the loadPercentClip first to the \_x position of the loadBarClip, and then move it along as the loadBarClip expands in \_width. This also assumes the loadBarClips registration point is set to the left (or right) and not centered.

---

<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:** [February 6, 2004, 9:32pm UTC](https://forum.kirupa.com/t/preloader-question/42151/6 "2004-02-06T21:32:36Z")

</div>

hey guys, thanks for all your input and help! ill try that stuff. its actually kinda cool, but last night right after i posted my question here i had an actionscript revelation. it all started to kinda make sense and the script that i added to my preloader script basically just set my instance name “percent”'s \_x equal to the \_width of my loadbar…i even got the pathing correct. and to my surprise it actually worked…i’m actually learning this stuff! thank you kirupa members!
