# Percent reader follows preload bar

**URL:** <https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738>\
**Category:** Uncategorized\
**Created:** [September 19, 2004, 1:08pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738 "2004-09-19T13:08:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![vagabond007](https://avatars.discourse-cdn.com/v4/letter/v/e480ec/32.png) [@vagabond007](https://forum.kirupa.com/u/vagabond007)\
**Post date:** [September 19, 2004, 1:08pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/1 "2004-09-19T13:08:21Z")

</div>

Hi –

Have a preloader bar that stretches from left to right until it fills a gauge in the background-- standard stuff.

Also have a KB numerical reader that calculates from 0 to 100%-- again standard stuff.

I would really like the numerical reader to follow the right hand side of the preloader bar as it grows from left to right. Can’t really figure it out.

Here is the preloader code-- pretty standard-- please, someone, help me make the KB reader move with the load bar width.

Thanks in advance, sure it must be simple, but confused as heck.

this.stop();  
// Stop movie and do the preloader.  
myInterval = setInterval(preloader, 1);  
function preloader() {  
if (getBytesLoaded()\>=getBytesTotal()) {  
\_parent.gotoAndPlay(3);  
clearInterval(myInterval);  
}  
loadbar.\_xscale = (getBytesLoaded()/getBytesTotal())\*100;  
loadtext.text=Math.round(getBytesLoaded()/getBytesTotal()\*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:** [September 19, 2004, 1:45pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/2 "2004-09-19T13:45:12Z")

</div>

> [@vagabond007](#):
>
> Hi –
> 
> Have a preloader bar that stretches from left to right until it fills a gauge in the background-- standard stuff.
> 
> Also have a KB numerical reader that calculates from 0 to 100%-- again standard stuff.
> 
> I would really like the numerical reader to follow the right hand side of the preloader bar as it grows from left to right. Can’t really figure it out.
> 
> Here is the preloader code-- pretty standard-- please, someone, help me make the KB reader move with the load bar width.
> 
> Thanks in advance, sure it must be simple, but confused as heck.
> 
> this.stop();  
> // Stop movie and do the preloader.  
> myInterval = setInterval(preloader, 1);  
> function preloader() {  
> if (getBytesLoaded()\>=getBytesTotal()) {  
> \_parent.gotoAndPlay(3);  
> clearInterval(myInterval);  
> }  
> loadbar.\_xscale = (getBytesLoaded()/getBytesTotal())\*100;  
> loadtext.text=Math.round(getBytesLoaded()/getBytesTotal()\*100)+“%”;  
> }

loadbar.\_xscale = (getBytesLoaded()/getBytesTotal())\*100;  
loadtext.text = Math.round(getBytesLoaded()/getBytesTotal()\*100)+“%”;  
loadtext.\_x = loadbar.\_x+loadbar.\_width;

you may need to add/subtract something to it.

---

<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:** [September 19, 2004, 6:40pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/3 "2004-09-19T18:40:13Z")

</div>

> [@stringy](#):
>
> loadbar.\_xscale = (getBytesLoaded()/getBytesTotal())\*100;  
> loadtext.text = Math.round(getBytesLoaded()/getBytesTotal()\*100)+“%”;  
> loadtext.\_x = loadbar.\_x+loadbar.\_width;
> 
> you may need to add/subtract something to it.

thank you very much!!! worked like a charm!

–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:** [September 19, 2004, 6:42pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/4 "2004-09-19T18:42:24Z")

</div>

> [@vagabond007](#):
>
> thank you very much!!! worked like a charm!
> 
> –Cheers!

welcome

---

<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:** [September 19, 2004, 7:27pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/5 "2004-09-19T19:27:41Z")

</div>

I’m looking to do something like this as well but my AS is a little different. I was trying to apply this code to mine but doesn’t seem to work.

On my loader bar:

```auto
onClipEvent(load) {
	total = _parent.getBytesTotal()/1000;
}
onClipEvent(enterFrame) {
	current=_parent.getBytesLoaded()/1000;
	if (total == current&&current > 5) { 
		_parent.gotoAndPlay(2);
	} 
	else {
		_parent.loadAmount = Math.round (current/total*32);
		this._xscale = Math.round (current/total*100);
	}
}

```

And my text box has a variable name of loadAmount. What do I need to modify in your code to apply it to my own? Thanks in advance.

---

<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:** [September 19, 2004, 7:44pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/6 "2004-09-19T19:44:44Z")

</div>

> [@beneath:the:sky](#):
>
> I’m looking to do something like this as well but my AS is a little different. I was trying to apply this code to mine but doesn’t seem to work.
> 
> On my loader bar:
> 
> ```auto
> onClipEvent(load) {
> total = _parent.getBytesTotal()/1000;
> }
> onClipEvent(enterFrame) {
> current=_parent.getBytesLoaded()/1000;
> if (total == current&&current > 5) { 
> _parent.gotoAndPlay(2);
> } 
> else {
> _parent.loadAmount = Math.round (current/total*32);
> this._xscale = Math.round (current/total*100);
> }
> }
> 
> ```
> 
> And my text box has a variable name of loadAmount. What do I need to modify in your code to apply it to my own? Thanks in advance.

give the textfield an instance name of myText

\_parent.loadAmount = Math.round(current/total_32);  
this.\_xscale = Math.round(current/total_100);  
\_parent.myText.\_x = this.\_x+this.\_width;

---

<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:** [September 19, 2004, 7:54pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/7 "2004-09-19T19:54:49Z")

</div>

Thanks very much 🙂 You rule.

---

<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:** [September 19, 2004, 8:21pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/8 "2004-09-19T20:21:42Z")

</div>

can you guys post a fla. because i can’t seem to get it going.

---

<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:** [September 20, 2004, 2:15pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/9 "2004-09-20T14:15:25Z")

</div>

Gupps,  
Here is the fla. Hope this helps, if you have any questions about it post them here because I can’t check my email from work.

[here](http://www.graforlock.com/preloader.fla)

---

<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:** [September 20, 2004, 2:45pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/10 "2004-09-20T14:45:28Z")

</div>

hi beneath the sky,  
the link is dead.

---

<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:** [September 20, 2004, 3:20pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/11 "2004-09-20T15:20:10Z")

</div>

Gupps,  
Sorry about that, I was in a hurry when I posted it. I will fix it when I get home later this afternoon.

edit: link is fixed

---

<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:** [September 21, 2004, 12:57pm UTC](https://forum.kirupa.com/t/percent-reader-follows-preload-bar/64738/12 "2004-09-21T12:57:49Z")

</div>

thanks beneath the sky. I’ll take a look at that right now
