# Bar Preload Help

**URL:** <https://forum.kirupa.com/t/bar-preload-help/19188>\
**Category:** flash\
**Created:** [April 25, 2003, 3:30am UTC](https://forum.kirupa.com/t/bar-preload-help/19188 "2003-04-25T03:30:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maxtr0sity](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@Maxtr0sity](https://forum.kirupa.com/u/Maxtr0sity)\
**Post date:** [April 25, 2003, 3:30am UTC](https://forum.kirupa.com/t/bar-preload-help/19188/1 "2003-04-25T03:30:23Z")

</div>

Hey, I followed through the preloading with bar tutorial offered on kirupa, the bar part worked fine, but for some reason, the % part didn’t. Ahmed gave me a different code, but doesn’t seem to work either, here’s his code:

onEnterFrame = function () {  
bytes\_loaded = Math.round(this.getBytesLoaded());  
bytes\_total = Math.round(this.getBytesTotal());  
getPercent = bytes\_loaded/bytes\_total;  
this.loadBar.\_width = getPercent_251;  
loadText = Math.round(getPercent_100)+"%";  
if (bytes\_loaded == bytes\_total) {  
delete this.onEnterFrame;  
this.gotoAndPlay(3);  
}  
};

I followed everything on the kirupa tutorial, and this is the only change. I need this please.=)

---

<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:** [April 25, 2003, 3:37am UTC](https://forum.kirupa.com/t/bar-preload-help/19188/2 "2003-04-25T03:37:46Z")

</div>

Make sure you have the VAR name of the textbox set to “loadText” (no quotes) and not the INSTANCE name. there is a difference, and they are both in properties panel.

---

<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:** [April 25, 2003, 3:43am UTC](https://forum.kirupa.com/t/bar-preload-help/19188/3 "2003-04-25T03:43:45Z")

</div>

OMG!..so that’s what ahmed was tryiing to tell me…then what is the instance name?

---

<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:** [April 25, 2003, 3:49am UTC](https://forum.kirupa.com/t/bar-preload-help/19188/4 "2003-04-25T03:49:46Z")

</div>

You don’t need to give it an instance name if you are using a var name.

I can’t really think straight right now to give a clear description of the difference between var name and instance name, but basically var name only allows you to edit the text of a textbox, but instance name allows you to target the textbox as an object and edit the textboxs’ properties dynamically through AS.

---

<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:** [April 25, 2003, 3:52am UTC](https://forum.kirupa.com/t/bar-preload-help/19188/5 "2003-04-25T03:52:07Z")

</div>

so instances are more of an object orented…and var has more of an AS relation?

---

<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:** [April 25, 2003, 3:58am UTC](https://forum.kirupa.com/t/bar-preload-help/19188/6 "2003-04-25T03:58:33Z")

</div>

It’s kind of similar the way textfields and variables work in Visual Basic 🙂

---

<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:** [April 25, 2003, 3:59am UTC](https://forum.kirupa.com/t/bar-preload-help/19188/7 "2003-04-25T03:59:29Z")

</div>

No, just basically the only thing the var name does is allows you to dynamically add text to the textbox and nothing else.

But if you use an instance name you are able to target the textbox and edit its properties through AS. Including TextFormat, restricting characters, enabling HTML text, etc, etc. And you can also use event handlers such as onChanged, or onSetFocus, and onKillFocus, etc, etc.

---

<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:** [April 25, 2003, 4:01am UTC](https://forum.kirupa.com/t/bar-preload-help/19188/8 "2003-04-25T04:01:01Z")

</div>

so instances are more physical property…not actual text

---

<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:** [April 25, 2003, 4:03am UTC](https://forum.kirupa.com/t/bar-preload-help/19188/9 "2003-04-25T04:03:44Z")

</div>

Well you can edit text as well.

Example of instance name text-

myTextBoxInstanceName.text = “asdf”

Example of var name text-

myTextBoxVarName = “asdf”

Think of it like changing the value of a variable. Instance name actually targets the textbox, but var name targets it like a variable.

Sorry if I make no sense, my head is kind of (well really) hazy tonight… soooo tiiired.

---

<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:** [April 25, 2003, 4:05am UTC](https://forum.kirupa.com/t/bar-preload-help/19188/10 "2003-04-25T04:05:04Z")

</div>

so it’s more specific
